home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2000 September / september_2000.iso / intercd / root / ^Linux / WindowMaker / ltmain.sh < prev    next >
Encoding:
Text File  |  2000-04-02  |  111.9 KB  |  4,013 lines

  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun ltconfig.
  3. #
  4. # Copyright (C) 1996-1999 Free Software Foundation, Inc.
  5. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25.  
  26. # Check that we have a working $echo.
  27. if test "X$1" = X--no-reexec; then
  28.   # Discard the --no-reexec flag, and continue.
  29.   shift
  30. elif test "X$1" = X--fallback-echo; then
  31.   # Avoid inline document here, it may be left over
  32.   :
  33. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  34.   # Yippee, $echo works!
  35.   :
  36. else
  37.   # Restart under the correct shell, and then maybe $echo will work.
  38.   exec $SHELL "$0" --no-reexec ${1+"$@"}
  39. fi
  40.  
  41. if test "X$1" = X--fallback-echo; then
  42.   # used as fallback echo
  43.   shift
  44.   cat <<EOF
  45. $*
  46. EOF
  47.   exit 0
  48. fi
  49.  
  50. # The name of this program.
  51. progname=`$echo "$0" | sed 's%^.*/%%'`
  52. modename="$progname"
  53.  
  54. # Constants.
  55. PROGRAM=ltmain.sh
  56. PACKAGE=libtool
  57. VERSION=1.3.4
  58. TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
  59.  
  60. default_mode=
  61. help="Try \`$progname --help' for more information."
  62. magic="%%%MAGIC variable%%%"
  63. mkdir="mkdir"
  64. mv="mv -f"
  65. rm="rm -f"
  66.  
  67. # Sed substitution that helps us do robust quoting.  It backslashifies
  68. # metacharacters that are still active within double-quoted strings.
  69. Xsed='sed -e 1s/^X//'
  70. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  71. SP2NL='tr \040 \012'
  72. NL2SP='tr \015\012 \040\040'
  73.  
  74. # NLS nuisances.
  75. # Only set LANG and LC_ALL to C if already set.
  76. # These must not be set unconditionally because not all systems understand
  77. # e.g. LANG=C (notably SCO).
  78. # We save the old values to restore during execute mode.
  79. if test "${LC_ALL+set}" = set; then
  80.   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  81. fi
  82. if test "${LANG+set}" = set; then
  83.   save_LANG="$LANG"; LANG=C; export LANG
  84. fi
  85.  
  86. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  87.   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  88.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  89.   exit 1
  90. fi
  91.  
  92. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  93.   echo "$modename: not configured to build any kind of library" 1>&2
  94.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  95.   exit 1
  96. fi
  97.  
  98. # Global variables.
  99. mode=$default_mode
  100. nonopt=
  101. prev=
  102. prevopt=
  103. run=
  104. show="$echo"
  105. show_help=
  106. execute_dlfiles=
  107. lo2o="s/\\.lo\$/.${objext}/"
  108. o2lo="s/\\.${objext}\$/.lo/"
  109.  
  110. # Parse our command line options once, thoroughly.
  111. while test $# -gt 0
  112. do
  113.   arg="$1"
  114.   shift
  115.  
  116.   case "$arg" in
  117.   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  118.   *) optarg= ;;
  119.   esac
  120.  
  121.   # If the previous option needs an argument, assign it.
  122.   if test -n "$prev"; then
  123.     case "$prev" in
  124.     execute_dlfiles)
  125.       eval "$prev=\"\$$prev \$arg\""
  126.       ;;
  127.     *)
  128.       eval "$prev=\$arg"
  129.       ;;
  130.     esac
  131.  
  132.     prev=
  133.     prevopt=
  134.     continue
  135.   fi
  136.  
  137.   # Have we seen a non-optional argument yet?
  138.   case "$arg" in
  139.   --help)
  140.     show_help=yes
  141.     ;;
  142.  
  143.   --version)
  144.     echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  145.     exit 0
  146.     ;;
  147.  
  148.   --config)
  149.     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
  150.     exit 0
  151.     ;;
  152.  
  153.   --debug)
  154.     echo "$progname: enabling shell trace mode"
  155.     set -x
  156.     ;;
  157.  
  158.   --dry-run | -n)
  159.     run=:
  160.     ;;
  161.  
  162.   --features)
  163.     echo "host: $host"
  164.     if test "$build_libtool_libs" = yes; then
  165.       echo "enable shared libraries"
  166.     else
  167.       echo "disable shared libraries"
  168.     fi
  169.     if test "$build_old_libs" = yes; then
  170.       echo "enable static libraries"
  171.     else
  172.       echo "disable static libraries"
  173.     fi
  174.     exit 0
  175.     ;;
  176.  
  177.   --finish) mode="finish" ;;
  178.  
  179.   --mode) prevopt="--mode" prev=mode ;;
  180.   --mode=*) mode="$optarg" ;;
  181.  
  182.   --quiet | --silent)
  183.     show=:
  184.     ;;
  185.  
  186.   -dlopen)
  187.     prevopt="-dlopen"
  188.     prev=execute_dlfiles
  189.     ;;
  190.  
  191.   -*)
  192.     $echo "$modename: unrecognized option \`$arg'" 1>&2
  193.     $echo "$help" 1>&2
  194.     exit 1
  195.     ;;
  196.  
  197.   *)
  198.     nonopt="$arg"
  199.     break
  200.     ;;
  201.   esac
  202. done
  203.  
  204. if test -n "$prevopt"; then
  205.   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  206.   $echo "$help" 1>&2
  207.   exit 1
  208. fi
  209.  
  210. if test -z "$show_help"; then
  211.  
  212.   # Infer the operation mode.
  213.   if test -z "$mode"; then
  214.     case "$nonopt" in
  215.     *cc | *++ | gcc* | *-gcc*)
  216.       mode=link
  217.       for arg
  218.       do
  219.     case "$arg" in
  220.     -c)
  221.        mode=compile
  222.        break
  223.        ;;
  224.     esac
  225.       done
  226.       ;;
  227.     *db | *dbx | *strace | *truss)
  228.       mode=execute
  229.       ;;
  230.     *install*|cp|mv)
  231.       mode=install
  232.       ;;
  233.     *rm)
  234.       mode=uninstall
  235.       ;;
  236.     *)
  237.       # If we have no mode, but dlfiles were specified, then do execute mode.
  238.       test -n "$execute_dlfiles" && mode=execute
  239.  
  240.       # Just use the default operation mode.
  241.       if test -z "$mode"; then
  242.     if test -n "$nonopt"; then
  243.       $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  244.     else
  245.       $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  246.     fi
  247.       fi
  248.       ;;
  249.     esac
  250.   fi
  251.  
  252.   # Only execute mode is allowed to have -dlopen flags.
  253.   if test -n "$execute_dlfiles" && test "$mode" != execute; then
  254.     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  255.     $echo "$help" 1>&2
  256.     exit 1
  257.   fi
  258.  
  259.   # Change the help message to a mode-specific one.
  260.   generic_help="$help"
  261.   help="Try \`$modename --help --mode=$mode' for more information."
  262.  
  263.   # These modes are in order of execution frequency so that they run quickly.
  264.   case "$mode" in
  265.   # libtool compile mode
  266.   compile)
  267.     modename="$modename: compile"
  268.     # Get the compilation command and the source file.
  269.     base_compile=
  270.     lastarg=
  271.     srcfile="$nonopt"
  272.     suppress_output=
  273.  
  274.     user_target=no
  275.     for arg
  276.     do
  277.       # Accept any command-line options.
  278.       case "$arg" in
  279.       -o)
  280.     if test "$user_target" != "no"; then
  281.       $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  282.       exit 1
  283.     fi
  284.     user_target=next
  285.     ;;
  286.  
  287.       -static)
  288.     build_old_libs=yes
  289.     continue
  290.     ;;
  291.       esac
  292.  
  293.       case "$user_target" in
  294.       next)
  295.     # The next one is the -o target name
  296.     user_target=yes
  297.     continue
  298.     ;;
  299.       yes)
  300.     # We got the output file
  301.     user_target=set
  302.     libobj="$arg"
  303.     continue
  304.     ;;
  305.       esac
  306.  
  307.       # Accept the current argument as the source file.
  308.       lastarg="$srcfile"
  309.       srcfile="$arg"
  310.  
  311.       # Aesthetically quote the previous argument.
  312.  
  313.       # Backslashify any backslashes, double quotes, and dollar signs.
  314.       # These are the only characters that are still specially
  315.       # interpreted inside of double-quoted scrings.
  316.       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  317.  
  318.       # Double-quote args containing other shell metacharacters.
  319.       # Many Bourne shells cannot handle close brackets correctly in scan
  320.       # sets, so we specify it separately.
  321.       case "$lastarg" in
  322.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  323.     lastarg="\"$lastarg\""
  324.     ;;
  325.       esac
  326.  
  327.       # Add the previous argument to base_compile.
  328.       if test -z "$base_compile"; then
  329.     base_compile="$lastarg"
  330.       else
  331.     base_compile="$base_compile $lastarg"
  332.       fi
  333.     done
  334.  
  335.     case "$user_target" in
  336.     set)
  337.       ;;
  338.     no)
  339.       # Get the name of the library object.
  340.       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  341.       ;;
  342.     *)
  343.       $echo "$modename: you must specify a target with \`-o'" 1>&2
  344.       exit 1
  345.       ;;
  346.     esac
  347.  
  348.     # Recognize several different file suffixes.
  349.     # If the user specifies -o file.o, it is replaced with file.lo
  350.     xform='[cCFSfmso]'
  351.     case "$libobj" in
  352.     *.ada) xform=ada ;;
  353.     *.adb) xform=adb ;;
  354.     *.ads) xform=ads ;;
  355.     *.asm) xform=asm ;;
  356.     *.c++) xform=c++ ;;
  357.     *.cc) xform=cc ;;
  358.     *.cpp) xform=cpp ;;
  359.     *.cxx) xform=cxx ;;
  360.     *.f90) xform=f90 ;;
  361.     *.for) xform=for ;;
  362.     esac
  363.  
  364.     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  365.  
  366.     case "$libobj" in
  367.     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  368.     *)
  369.       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  370.       exit 1
  371.       ;;
  372.     esac
  373.  
  374.     if test -z "$base_compile"; then
  375.       $echo "$modename: you must specify a compilation command" 1>&2
  376.       $echo "$help" 1>&2
  377.       exit 1
  378.     fi
  379.  
  380.     # Delete any leftover library objects.
  381.     if test "$build_old_libs" = yes; then
  382.       removelist="$obj $libobj"
  383.     else
  384.       removelist="$libobj"
  385.     fi
  386.  
  387.     $run $rm $removelist
  388.     trap "$run $rm $removelist; exit 1" 1 2 15
  389.  
  390.     # Calculate the filename of the output object if compiler does
  391.     # not support -o with -c
  392.     if test "$compiler_c_o" = no; then
  393.       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
  394.       lockfile="$output_obj.lock"
  395.       removelist="$removelist $output_obj $lockfile"
  396.       trap "$run $rm $removelist; exit 1" 1 2 15
  397.     else
  398.       need_locks=no
  399.       lockfile=
  400.     fi
  401.  
  402.     # Lock this critical section if it is needed
  403.     # We use this script file to make the link, it avoids creating a new file
  404.     if test "$need_locks" = yes; then
  405.       until ln "$0" "$lockfile" 2>/dev/null; do
  406.     $show "Waiting for $lockfile to be removed"
  407.     sleep 2
  408.       done
  409.     elif test "$need_locks" = warn; then
  410.       if test -f "$lockfile"; then
  411.     echo "\
  412. *** ERROR, $lockfile exists and contains:
  413. `cat $lockfile 2>/dev/null`
  414.  
  415. This indicates that another process is trying to use the same
  416. temporary object file, and libtool could not work around it because
  417. your compiler does not support \`-c' and \`-o' together.  If you
  418. repeat this compilation, it may succeed, by chance, but you had better
  419. avoid parallel builds (make -j) in this platform, or get a better
  420. compiler."
  421.  
  422.     $run $rm $removelist
  423.     exit 1
  424.       fi
  425.       echo $srcfile > "$lockfile"
  426.     fi
  427.  
  428.     if test -n "$fix_srcfile_path"; then
  429.       eval srcfile=\"$fix_srcfile_path\"
  430.     fi
  431.  
  432.     # Only build a PIC object if we are building libtool libraries.
  433.     if test "$build_libtool_libs" = yes; then
  434.       # Without this assignment, base_compile gets emptied.
  435.       fbsd_hideous_sh_bug=$base_compile
  436.  
  437.       # All platforms use -DPIC, to notify preprocessed assembler code.
  438.       command="$base_compile $srcfile $pic_flag -DPIC"
  439.       if test "$build_old_libs" = yes; then
  440.     lo_libobj="$libobj"
  441.     dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  442.     if test "X$dir" = "X$libobj"; then
  443.       dir="$objdir"
  444.     else
  445.       dir="$dir/$objdir"
  446.     fi
  447.     libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  448.  
  449.     if test -d "$dir"; then
  450.       $show "$rm $libobj"
  451.       $run $rm $libobj
  452.     else
  453.       $show "$mkdir $dir"
  454.       $run $mkdir $dir
  455.       status=$?
  456.       if test $status -ne 0 && test ! -d $dir; then
  457.         exit $status
  458.       fi
  459.     fi
  460.       fi
  461.       if test "$compiler_o_lo" = yes; then
  462.     output_obj="$libobj"
  463.     command="$command -o $output_obj"
  464.       elif test "$compiler_c_o" = yes; then
  465.     output_obj="$obj"
  466.     command="$command -o $output_obj"
  467.       fi
  468.  
  469.       $run $rm "$output_obj"
  470.       $show "$command"
  471.       if $run eval "$command"; then :
  472.       else
  473.     test -n "$output_obj" && $run $rm $removelist
  474.     exit 1
  475.       fi
  476.  
  477.       if test "$need_locks" = warn &&
  478.      test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  479.     echo "\
  480. *** ERROR, $lockfile contains:
  481. `cat $lockfile 2>/dev/null`
  482.  
  483. but it should contain:
  484. $srcfile
  485.  
  486. This indicates that another process is trying to use the same
  487. temporary object file, and libtool could not work around it because
  488. your compiler does not support \`-c' and \`-o' together.  If you
  489. repeat this compilation, it may succeed, by chance, but you had better
  490. avoid parallel builds (make -j) in this platform, or get a better
  491. compiler."
  492.  
  493.     $run $rm $removelist
  494.     exit 1
  495.       fi
  496.  
  497.       # Just move the object if needed, then go on to compile the next one
  498.       if test x"$output_obj" != x"$libobj"; then
  499.     $show "$mv $output_obj $libobj"
  500.     if $run $mv $output_obj $libobj; then :
  501.     else
  502.       error=$?
  503.       $run $rm $removelist
  504.       exit $error
  505.     fi
  506.       fi
  507.  
  508.       # If we have no pic_flag, then copy the object into place and finish.
  509.       if test -z "$pic_flag" && test "$build_old_libs" = yes; then
  510.     # Rename the .lo from within objdir to obj
  511.     if test -f $obj; then
  512.       $show $rm $obj
  513.       $run $rm $obj
  514.     fi
  515.  
  516.     $show "$mv $libobj $obj"
  517.     if $run $mv $libobj $obj; then :
  518.     else
  519.       error=$?
  520.       $run $rm $removelist
  521.       exit $error
  522.     fi
  523.  
  524.     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  525.     if test "X$xdir" = "X$obj"; then
  526.       xdir="."
  527.     else
  528.       xdir="$xdir"
  529.     fi
  530.     baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
  531.     libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  532.     # Now arrange that obj and lo_libobj become the same file
  533.     $show "(cd $xdir && $LN_S $baseobj $libobj)"
  534.     if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
  535.       exit 0
  536.     else
  537.       error=$?
  538.       $run $rm $removelist
  539.       exit $error
  540.     fi
  541.       fi
  542.  
  543.       # Allow error messages only from the first compilation.
  544.       suppress_output=' >/dev/null 2>&1'
  545.     fi
  546.  
  547.     # Only build a position-dependent object if we build old libraries.
  548.     if test "$build_old_libs" = yes; then
  549.       command="$base_compile $srcfile"
  550.       if test "$compiler_c_o" = yes; then
  551.     command="$command -o $obj"
  552.     output_obj="$obj"
  553.       fi
  554.  
  555.       # Suppress compiler output if we already did a PIC compilation.
  556.       command="$command$suppress_output"
  557.       $run $rm "$output_obj"
  558.       $show "$command"
  559.       if $run eval "$command"; then :
  560.       else
  561.     $run $rm $removelist
  562.     exit 1
  563.       fi
  564.  
  565.       if test "$need_locks" = warn &&
  566.      test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  567.     echo "\
  568. *** ERROR, $lockfile contains:
  569. `cat $lockfile 2>/dev/null`
  570.  
  571. but it should contain:
  572. $srcfile
  573.  
  574. This indicates that another process is trying to use the same
  575. temporary object file, and libtool could not work around it because
  576. your compiler does not support \`-c' and \`-o' together.  If you
  577. repeat this compilation, it may succeed, by chance, but you had better
  578. avoid parallel builds (make -j) in this platform, or get a better
  579. compiler."
  580.  
  581.     $run $rm $removelist
  582.     exit 1
  583.       fi
  584.  
  585.       # Just move the object if needed
  586.       if test x"$output_obj" != x"$obj"; then
  587.     $show "$mv $output_obj $obj"
  588.     if $run $mv $output_obj $obj; then :
  589.     else
  590.       error=$?
  591.       $run $rm $removelist
  592.       exit $error
  593.     fi
  594.       fi
  595.  
  596.       # Create an invalid libtool object if no PIC, so that we do not
  597.       # accidentally link it into a program.
  598.       if test "$build_libtool_libs" != yes; then
  599.     $show "echo timestamp > $libobj"
  600.     $run eval "echo timestamp > \$libobj" || exit $?
  601.       else
  602.     # Move the .lo from within objdir
  603.     $show "$mv $libobj $lo_libobj"
  604.     if $run $mv $libobj $lo_libobj; then :
  605.     else
  606.       error=$?
  607.       $run $rm $removelist
  608.       exit $error
  609.     fi
  610.       fi
  611.     fi
  612.  
  613.     # Unlock the critical section if it was locked
  614.     if test "$need_locks" != no; then
  615.       $rm "$lockfile"
  616.     fi
  617.  
  618.     exit 0
  619.     ;;
  620.  
  621.   # libtool link mode
  622.   link)
  623.     modename="$modename: link"
  624.     case "$host" in
  625.     *-*-cygwin* | *-*-mingw* | *-*-os2*)
  626.       # It is impossible to link a dll without this setting, and
  627.       # we shouldn't force the makefile maintainer to figure out
  628.       # which system we are compiling for in order to pass an extra
  629.       # flag for every libtool invokation.
  630.       # allow_undefined=no
  631.  
  632.       # FIXME: Unfortunately, there are problems with the above when trying
  633.       # to make a dll which has undefined symbols, in which case not
  634.       # even a static library is built.  For now, we need to specify
  635.       # -no-undefined on the libtool link line when we can be certain
  636.       # that all symbols are satisfied, otherwise we get a static library.
  637.       allow_undefined=yes
  638.  
  639.       # This is a source program that is used to create dlls on Windows
  640.       # Don't remove nor modify the starting and closing comments
  641. # /* ltdll.c starts here */
  642. # #define WIN32_LEAN_AND_MEAN
  643. # #include <windows.h>
  644. # #undef WIN32_LEAN_AND_MEAN
  645. # #include <stdio.h>
  646. #
  647. # #ifndef __CYGWIN__
  648. # #  ifdef __CYGWIN32__
  649. # #    define __CYGWIN__ __CYGWIN32__
  650. # #  endif
  651. # #endif
  652. #
  653. # #ifdef __cplusplus
  654. # extern "C" {
  655. # #endif
  656. # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
  657. # #ifdef __cplusplus
  658. # }
  659. # #endif
  660. #
  661. # #ifdef __CYGWIN__
  662. # #include <cygwin/cygwin_dll.h>
  663. # DECLARE_CYGWIN_DLL( DllMain );
  664. # #endif
  665. # HINSTANCE __hDllInstance_base;
  666. #
  667. # BOOL APIENTRY
  668. # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
  669. # {
  670. #   __hDllInstance_base = hInst;
  671. #   return TRUE;
  672. # }
  673. # /* ltdll.c ends here */
  674.       # This is a source program that is used to create import libraries
  675.       # on Windows for dlls which lack them. Don't remove nor modify the
  676.       # starting and closing comments
  677. # /* impgen.c starts here */
  678. # /*   Copyright (C) 1999 Free Software Foundation, Inc.
  679. #  This file is part of GNU libtool.
  680. #  This program is free software; you can redistribute it and/or modify
  681. #  it under the terms of the GNU General Public License as published by
  682. #  the Free Software Foundation; either version 2 of the License, or
  683. #  (at your option) any later version.
  684. #  This program is distributed in the hope that it will be useful,
  685. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  686. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  687. #  GNU General Public License for more details.
  688. #  You should have received a copy of the GNU General Public License
  689. #  along with this program; if not, write to the Free Software
  690. #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  691. #  */
  692. #  #include <stdio.h>        /* for printf() */
  693. #  #include <unistd.h>        /* for open(), lseek(), read() */
  694. #  #include <fcntl.h>        /* for O_RDONLY, O_BINARY */
  695. #  #include <string.h>        /* for strdup() */
  696. #  static unsigned int
  697. #  pe_get16 (fd, offset)
  698. #       int fd;
  699. #       int offset;
  700. #  {
  701. #    unsigned char b[2];
  702. #    lseek (fd, offset, SEEK_SET);
  703. #    read (fd, b, 2);
  704. #    return b[0] + (b[1]<<8);
  705. #  }
  706. #  static unsigned int
  707. #  pe_get32 (fd, offset)
  708. #      int fd;
  709. #      int offset;
  710. #  {
  711. #    unsigned char b[4];
  712. #    lseek (fd, offset, SEEK_SET);
  713. #    read (fd, b, 4);
  714. #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  715. #  }
  716. #  static unsigned int
  717. #  pe_as32 (ptr)
  718. #       void *ptr;
  719. #  {
  720. #    unsigned char *b = ptr;
  721. #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  722. #  }
  723. #  int
  724. #  main (argc, argv)
  725. #      int argc;
  726. #      char *argv[];
  727. #  {
  728. #      int dll;
  729. #      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
  730. #      unsigned long export_rva, export_size, nsections, secptr, expptr;
  731. #      unsigned long name_rvas, nexp;
  732. #      unsigned char *expdata, *erva;
  733. #      char *filename, *dll_name;
  734. #      filename = argv[1];
  735. #      dll = open(filename, O_RDONLY|O_BINARY);
  736. #      if (!dll)
  737. #      return 1;
  738. #      dll_name = filename;
  739. #    
  740. #      for (i=0; filename[i]; i++)
  741. #      if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
  742. #          dll_name = filename + i +1;
  743. #      pe_header_offset = pe_get32 (dll, 0x3c);
  744. #      opthdr_ofs = pe_header_offset + 4 + 20;
  745. #      num_entries = pe_get32 (dll, opthdr_ofs + 92);
  746. #      if (num_entries < 1) /* no exports */
  747. #      return 1;
  748. #      export_rva = pe_get32 (dll, opthdr_ofs + 96);
  749. #      export_size = pe_get32 (dll, opthdr_ofs + 100);
  750. #      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
  751. #      secptr = (pe_header_offset + 4 + 20 +
  752. #            pe_get16 (dll, pe_header_offset + 4 + 16));
  753. #      expptr = 0;
  754. #      for (i = 0; i < nsections; i++)
  755. #      {
  756. #      char sname[8];
  757. #      unsigned long secptr1 = secptr + 40 * i;
  758. #      unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
  759. #      unsigned long vsize = pe_get32 (dll, secptr1 + 16);
  760. #      unsigned long fptr = pe_get32 (dll, secptr1 + 20);
  761. #      lseek(dll, secptr1, SEEK_SET);
  762. #      read(dll, sname, 8);
  763. #      if (vaddr <= export_rva && vaddr+vsize > export_rva)
  764. #      {
  765. #          expptr = fptr + (export_rva - vaddr);
  766. #          if (export_rva + export_size > vaddr + vsize)
  767. #          export_size = vsize - (export_rva - vaddr);
  768. #          break;
  769. #      }
  770. #      }
  771. #      expdata = (unsigned char*)malloc(export_size);
  772. #      lseek (dll, expptr, SEEK_SET);
  773. #      read (dll, expdata, export_size);
  774. #      erva = expdata - export_rva;
  775. #      nexp = pe_as32 (expdata+24);
  776. #      name_rvas = pe_as32 (expdata+32);
  777. #      printf ("EXPORTS\n");
  778. #      for (i = 0; i<nexp; i++)
  779. #      {
  780. #      unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
  781. #      printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
  782. #      }
  783. #      return 0;
  784. #  }
  785. # /* impgen.c ends here */
  786.       ;;
  787.     *)
  788.       allow_undefined=yes
  789.       ;;
  790.     esac
  791.     compile_command="$nonopt"
  792.     finalize_command="$nonopt"
  793.  
  794.     compile_rpath=
  795.     finalize_rpath=
  796.     compile_shlibpath=
  797.     finalize_shlibpath=
  798.     convenience=
  799.     old_convenience=
  800.     deplibs=
  801.     linkopts=
  802.  
  803.     if test -n "$shlibpath_var"; then
  804.       # get the directories listed in $shlibpath_var
  805.       eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  806.     else
  807.       lib_search_path=
  808.     fi
  809.     # now prepend the system-specific ones
  810.     eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
  811.     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  812.     
  813.     avoid_version=no
  814.     dlfiles=
  815.     dlprefiles=
  816.     dlself=no
  817.     export_dynamic=no
  818.     export_symbols=
  819.     export_symbols_regex=
  820.     generated=
  821.     libobjs=
  822.     link_against_libtool_libs=
  823.     ltlibs=
  824.     module=no
  825.     objs=
  826.     prefer_static_libs=no
  827.     preload=no
  828.     prev=
  829.     prevarg=
  830.     release=
  831.     rpath=
  832.     xrpath=
  833.     perm_rpath=
  834.     temp_rpath=
  835.     thread_safe=no
  836.     vinfo=
  837.  
  838.     # We need to know -static, to get the right output filenames.
  839.     for arg
  840.     do
  841.       case "$arg" in
  842.       -all-static | -static)
  843.     if test "X$arg" = "X-all-static"; then
  844.       if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  845.         $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  846.       fi
  847.       if test -n "$link_static_flag"; then
  848.         dlopen_self=$dlopen_self_static
  849.       fi
  850.     else
  851.       if test -z "$pic_flag" && test -n "$link_static_flag"; then
  852.         dlopen_self=$dlopen_self_static
  853.       fi
  854.     fi
  855.     build_libtool_libs=no
  856.     build_old_libs=yes
  857.     prefer_static_libs=yes
  858.     break
  859.     ;;
  860.       esac
  861.     done
  862.  
  863.     # See if our shared archives depend on static archives.
  864.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  865.  
  866.     # Go through the arguments, transforming them on the way.
  867.     while test $# -gt 0; do
  868.       arg="$1"
  869.       shift
  870.  
  871.       # If the previous option needs an argument, assign it.
  872.       if test -n "$prev"; then
  873.     case "$prev" in
  874.     output)
  875.       compile_command="$compile_command @OUTPUT@"
  876.       finalize_command="$finalize_command @OUTPUT@"
  877.       ;;
  878.     esac
  879.  
  880.     case "$prev" in
  881.     dlfiles|dlprefiles)
  882.       if test "$preload" = no; then
  883.         # Add the symbol object into the linking commands.
  884.         compile_command="$compile_command @SYMFILE@"
  885.         finalize_command="$finalize_command @SYMFILE@"
  886.         preload=yes
  887.       fi
  888.       case "$arg" in
  889.       *.la | *.lo) ;;  # We handle these cases below.
  890.       force)
  891.         if test "$dlself" = no; then
  892.           dlself=needless
  893.           export_dynamic=yes
  894.         fi
  895.         prev=
  896.         continue
  897.         ;;
  898.       self)
  899.         if test "$prev" = dlprefiles; then
  900.           dlself=yes
  901.         elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  902.           dlself=yes
  903.         else
  904.           dlself=needless
  905.           export_dynamic=yes
  906.         fi
  907.         prev=
  908.         continue
  909.         ;;
  910.       *)
  911.         if test "$prev" = dlfiles; then
  912.           dlfiles="$dlfiles $arg"
  913.         else
  914.           dlprefiles="$dlprefiles $arg"
  915.         fi
  916.         prev=
  917.         ;;
  918.       esac
  919.       ;;
  920.     expsyms)
  921.       export_symbols="$arg"
  922.       if test ! -f "$arg"; then
  923.         $echo "$modename: symbol file \`$arg' does not exist"
  924.         exit 1
  925.       fi
  926.       prev=
  927.       continue
  928.       ;;
  929.     expsyms_regex)
  930.       export_symbols_regex="$arg"
  931.       prev=
  932.       continue
  933.       ;;
  934.     release)
  935.       release="-$arg"
  936.       prev=
  937.       continue
  938.       ;;
  939.     rpath | xrpath)
  940.       # We need an absolute path.
  941.       case "$arg" in
  942.       [\\/]* | [A-Za-z]:[\\/]*) ;;
  943.       *)
  944.         $echo "$modename: only absolute run-paths are allowed" 1>&2
  945.         exit 1
  946.         ;;
  947.       esac
  948.       if test "$prev" = rpath; then
  949.         case "$rpath " in
  950.         *" $arg "*) ;;
  951.         *) rpath="$rpath $arg" ;;
  952.         esac
  953.       else
  954.         case "$xrpath " in
  955.         *" $arg "*) ;;
  956.         *) xrpath="$xrpath $arg" ;;
  957.         esac
  958.       fi
  959.       prev=
  960.       continue
  961.       ;;
  962.     *)
  963.       eval "$prev=\"\$arg\""
  964.       prev=
  965.       continue
  966.       ;;
  967.     esac
  968.       fi
  969.  
  970.       prevarg="$arg"
  971.  
  972.       case "$arg" in
  973.       -all-static)
  974.     if test -n "$link_static_flag"; then
  975.       compile_command="$compile_command $link_static_flag"
  976.       finalize_command="$finalize_command $link_static_flag"
  977.     fi
  978.     continue
  979.     ;;
  980.  
  981.       -allow-undefined)
  982.     # FIXME: remove this flag sometime in the future.
  983.     $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  984.     continue
  985.     ;;
  986.  
  987.       -avoid-version)
  988.     avoid_version=yes
  989.     continue
  990.     ;;
  991.  
  992.       -dlopen)
  993.     prev=dlfiles
  994.     continue
  995.     ;;
  996.  
  997.       -dlpreopen)
  998.     prev=dlprefiles
  999.     continue
  1000.     ;;
  1001.  
  1002.       -export-dynamic)
  1003.     export_dynamic=yes
  1004.     continue
  1005.     ;;
  1006.  
  1007.       -export-symbols | -export-symbols-regex)
  1008.     if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1009.       $echo "$modename: not more than one -exported-symbols argument allowed"
  1010.       exit 1
  1011.     fi
  1012.     if test "X$arg" = "X-export-symbols"; then
  1013.       prev=expsyms
  1014.     else
  1015.       prev=expsyms_regex
  1016.     fi
  1017.     continue
  1018.     ;;
  1019.  
  1020.       -L*)
  1021.     dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1022.     # We need an absolute path.
  1023.     case "$dir" in
  1024.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  1025.     *)
  1026.       absdir=`cd "$dir" && pwd`
  1027.       if test -z "$absdir"; then
  1028.         $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1029.         $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1030.         absdir="$dir"
  1031.       fi
  1032.       dir="$absdir"
  1033.       ;;
  1034.     esac
  1035.     case " $deplibs " in
  1036.     *" $arg "*) ;;
  1037.     *) deplibs="$deplibs $arg";;
  1038.     esac
  1039.     case " $lib_search_path " in
  1040.     *" $dir "*) ;;
  1041.     *) lib_search_path="$lib_search_path $dir";;
  1042.     esac
  1043.     case "$host" in
  1044.     *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1045.       dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1046.       case ":$dllsearchpath:" in
  1047.       ::) dllsearchpath="$dllsearchdir";;
  1048.       *":$dllsearchdir:"*) ;;
  1049.       *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  1050.       esac
  1051.       ;;
  1052.     esac
  1053.     ;;
  1054.  
  1055.       -l*)
  1056.     if test "$arg" = "-lc"; then
  1057.       case "$host" in
  1058.       *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1059.         # These systems don't actually have c library (as such)
  1060.         continue
  1061.         ;;
  1062.       esac
  1063.     elif test "$arg" = "-lm"; then
  1064.       case "$host" in
  1065.       *-*-cygwin* | *-*-beos*)
  1066.         # These systems don't actually have math library (as such)
  1067.         continue
  1068.         ;;
  1069.       esac
  1070.     fi
  1071.     deplibs="$deplibs $arg"
  1072.     ;;
  1073.  
  1074.       -module)
  1075.     module=yes
  1076.     continue
  1077.     ;;
  1078.  
  1079.       -no-undefined)
  1080.     allow_undefined=no
  1081.     continue
  1082.     ;;
  1083.  
  1084.       -o) prev=output ;;
  1085.  
  1086.       -release)
  1087.     prev=release
  1088.     continue
  1089.     ;;
  1090.  
  1091.       -rpath)
  1092.     prev=rpath
  1093.     continue
  1094.     ;;
  1095.  
  1096.       -R)
  1097.     prev=xrpath
  1098.     continue
  1099.     ;;
  1100.  
  1101.       -R*)
  1102.     dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1103.     # We need an absolute path.
  1104.     case "$dir" in
  1105.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  1106.     *)
  1107.       $echo "$modename: only absolute run-paths are allowed" 1>&2
  1108.       exit 1
  1109.       ;;
  1110.     esac
  1111.     case "$xrpath " in
  1112.     *" $dir "*) ;;
  1113.     *) xrpath="$xrpath $dir" ;;
  1114.     esac
  1115.     continue
  1116.     ;;
  1117.  
  1118.       -static)
  1119.     # If we have no pic_flag, then this is the same as -all-static.
  1120.     if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1121.       compile_command="$compile_command $link_static_flag"
  1122.       finalize_command="$finalize_command $link_static_flag"
  1123.     fi
  1124.     continue
  1125.     ;;
  1126.  
  1127.       -thread-safe)
  1128.     thread_safe=yes
  1129.     continue
  1130.     ;;
  1131.  
  1132.       -version-info)
  1133.     prev=vinfo
  1134.     continue
  1135.     ;;
  1136.  
  1137.       # Some other compiler flag.
  1138.       -* | +*)
  1139.     # Unknown arguments in both finalize_command and compile_command need
  1140.     # to be aesthetically quoted because they are evaled later.
  1141.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1142.     case "$arg" in
  1143.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1144.       arg="\"$arg\""
  1145.       ;;
  1146.     esac
  1147.     ;;
  1148.  
  1149.       *.o | *.obj | *.a | *.lib)
  1150.     # A standard object.
  1151.     objs="$objs $arg"
  1152.     ;;
  1153.  
  1154.       *.lo)
  1155.     # A library object.
  1156.     if test "$prev" = dlfiles; then
  1157.       dlfiles="$dlfiles $arg"
  1158.       if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1159.         prev=
  1160.         continue
  1161.       else
  1162.         # If libtool objects are unsupported, then we need to preload.
  1163.         prev=dlprefiles
  1164.       fi
  1165.     fi
  1166.  
  1167.     if test "$prev" = dlprefiles; then
  1168.       # Preload the old-style object.
  1169.       dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1170.       prev=
  1171.     fi
  1172.     libobjs="$libobjs $arg"
  1173.     ;;
  1174.  
  1175.       *.la)
  1176.     # A libtool-controlled library.
  1177.  
  1178.     dlname=
  1179.     libdir=
  1180.     library_names=
  1181.     old_library=
  1182.  
  1183.     # Check to see that this really is a libtool archive.
  1184.     if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1185.     else
  1186.       $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1187.       exit 1
  1188.     fi
  1189.  
  1190.     # If the library was installed with an old release of libtool,
  1191.     # it will not redefine variable installed.
  1192.     installed=yes
  1193.  
  1194.     # Read the .la file
  1195.     # If there is no directory component, then add one.
  1196.     case "$arg" in
  1197.     */* | *\\*) . $arg ;;
  1198.     *) . ./$arg ;;
  1199.     esac
  1200.  
  1201.     # Get the name of the library we link against.
  1202.     linklib=
  1203.     for l in $old_library $library_names; do
  1204.       linklib="$l"
  1205.     done
  1206.  
  1207.     if test -z "$linklib"; then
  1208.       $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1209.       exit 1
  1210.     fi
  1211.  
  1212.     # Find the relevant object directory and library name.
  1213.     name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1214.  
  1215.     if test "X$installed" = Xyes; then
  1216.       dir="$libdir"
  1217.     else
  1218.       dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1219.       if test "X$dir" = "X$arg"; then
  1220.         dir="$objdir"
  1221.       else
  1222.         dir="$dir/$objdir"
  1223.       fi
  1224.     fi
  1225.  
  1226.     if test -n "$dependency_libs"; then
  1227.       # Extract -R and -L from dependency_libs
  1228.       temp_deplibs=
  1229.       for deplib in $dependency_libs; do
  1230.         case "$deplib" in
  1231.         -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1232.          case " $rpath $xrpath " in
  1233.          *" $temp_xrpath "*) ;;
  1234.          *) xrpath="$xrpath $temp_xrpath";;
  1235.          esac;;
  1236.         -L*) case "$compile_command $temp_deplibs " in
  1237.          *" $deplib "*) ;;
  1238.          *) temp_deplibs="$temp_deplibs $deplib";;
  1239.          esac
  1240.          temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1241.          case " $lib_search_path " in
  1242.          *" $temp_dir "*) ;;
  1243.          *) lib_search_path="$lib_search_path $temp_dir";;
  1244.          esac
  1245.          ;;
  1246.         *) temp_deplibs="$temp_deplibs $deplib";;
  1247.         esac
  1248.       done
  1249.       dependency_libs="$temp_deplibs"
  1250.     fi
  1251.  
  1252.     if test -z "$libdir"; then
  1253.       # It is a libtool convenience library, so add in its objects.
  1254.       convenience="$convenience $dir/$old_library"
  1255.       old_convenience="$old_convenience $dir/$old_library"
  1256.       deplibs="$deplibs$dependency_libs"
  1257.       compile_command="$compile_command $dir/$old_library$dependency_libs"
  1258.       finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1259.       continue
  1260.     fi
  1261.  
  1262.     # This library was specified with -dlopen.
  1263.     if test "$prev" = dlfiles; then
  1264.       dlfiles="$dlfiles $arg"
  1265.       if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1266.         # If there is no dlname, no dlopen support or we're linking statically,
  1267.         # we need to preload.
  1268.         prev=dlprefiles
  1269.       else
  1270.         # We should not create a dependency on this library, but we
  1271.         # may need any libraries it requires.
  1272.         compile_command="$compile_command$dependency_libs"
  1273.         finalize_command="$finalize_command$dependency_libs"
  1274.         prev=
  1275.         continue
  1276.       fi
  1277.     fi
  1278.  
  1279.     # The library was specified with -dlpreopen.
  1280.     if test "$prev" = dlprefiles; then
  1281.       # Prefer using a static library (so that no silly _DYNAMIC symbols
  1282.       # are required to link).
  1283.       if test -n "$old_library"; then
  1284.         dlprefiles="$dlprefiles $dir/$old_library"
  1285.       else
  1286.         dlprefiles="$dlprefiles $dir/$linklib"
  1287.       fi
  1288.       prev=
  1289.     fi
  1290.  
  1291.     if test -n "$library_names" &&
  1292.        { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1293.       link_against_libtool_libs="$link_against_libtool_libs $arg"
  1294.       if test -n "$shlibpath_var"; then
  1295.         # Make sure the rpath contains only unique directories.
  1296.         case "$temp_rpath " in
  1297.         *" $dir "*) ;;
  1298.         *) temp_rpath="$temp_rpath $dir" ;;
  1299.         esac
  1300.       fi
  1301.  
  1302.       # We need an absolute path.
  1303.       case "$dir" in
  1304.       [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1305.       *)
  1306.         absdir=`cd "$dir" && pwd`
  1307.         if test -z "$absdir"; then
  1308.           $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1309.           $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1310.           absdir="$dir"
  1311.         fi
  1312.         ;;
  1313.       esac
  1314.       
  1315.       # This is the magic to use -rpath.
  1316.       # Skip directories that are in the system default run-time
  1317.       # search path, unless they have been requested with -R.
  1318.       case " $sys_lib_dlsearch_path " in
  1319.       *" $absdir "*) ;;
  1320.       *)
  1321.         case "$compile_rpath " in
  1322.         *" $absdir "*) ;;
  1323.         *) compile_rpath="$compile_rpath $absdir" 
  1324.         esac
  1325.         ;;
  1326.       esac
  1327.  
  1328.       case " $sys_lib_dlsearch_path " in
  1329.       *" $libdir "*) ;;
  1330.       *)
  1331.         case "$finalize_rpath " in
  1332.         *" $libdir "*) ;;
  1333.         *) finalize_rpath="$finalize_rpath $libdir"
  1334.         esac
  1335.         ;;
  1336.       esac
  1337.  
  1338.       lib_linked=yes
  1339.       case "$hardcode_action" in
  1340.       immediate | unsupported)
  1341.         if test "$hardcode_direct" = no; then
  1342.           compile_command="$compile_command $dir/$linklib"
  1343.           deplibs="$deplibs $dir/$linklib"
  1344.           case "$host" in
  1345.           *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1346.         dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1347.         if test -n "$dllsearchpath"; then
  1348.           dllsearchpath="$dllsearchpath:$dllsearchdir"
  1349.         else
  1350.           dllsearchpath="$dllsearchdir"
  1351.         fi
  1352.         ;;
  1353.           esac
  1354.         elif test "$hardcode_minus_L" = no; then
  1355.           case "$host" in
  1356.           *-*-sunos*)
  1357.         compile_shlibpath="$compile_shlibpath$dir:"
  1358.         ;;
  1359.           esac
  1360.           case "$compile_command " in
  1361.           *" -L$dir "*) ;;
  1362.           *) compile_command="$compile_command -L$dir";;
  1363.           esac
  1364.           compile_command="$compile_command -l$name"
  1365.           deplibs="$deplibs -L$dir -l$name"
  1366.         elif test "$hardcode_shlibpath_var" = no; then
  1367.           case ":$compile_shlibpath:" in
  1368.           *":$dir:"*) ;;
  1369.           *) compile_shlibpath="$compile_shlibpath$dir:";;
  1370.           esac
  1371.           compile_command="$compile_command -l$name"
  1372.           deplibs="$deplibs -l$name"
  1373.         else
  1374.           lib_linked=no
  1375.         fi
  1376.         ;;
  1377.  
  1378.       relink)
  1379.         if test "$hardcode_direct" = yes; then
  1380.           compile_command="$compile_command $absdir/$linklib"
  1381.           deplibs="$deplibs $absdir/$linklib"
  1382.         elif test "$hardcode_minus_L" = yes; then
  1383.           case "$compile_command " in
  1384.           *" -L$absdir "*) ;;
  1385.           *) compile_command="$compile_command -L$absdir";;
  1386.           esac
  1387.           compile_command="$compile_command -l$name"
  1388.           deplibs="$deplibs -L$absdir -l$name"
  1389.         elif test "$hardcode_shlibpath_var" = yes; then
  1390.           case ":$compile_shlibpath:" in
  1391.           *":$absdir:"*) ;;
  1392.           *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1393.           esac
  1394.           compile_command="$compile_command -l$name"
  1395.           deplibs="$deplibs -l$name"
  1396.         else
  1397.           lib_linked=no
  1398.         fi
  1399.         ;;
  1400.  
  1401.       *)
  1402.         lib_linked=no
  1403.         ;;
  1404.       esac
  1405.  
  1406.       if test "$lib_linked" != yes; then
  1407.         $echo "$modename: configuration error: unsupported hardcode properties"
  1408.         exit 1
  1409.       fi
  1410.  
  1411.       # Finalize command for both is simple: just hardcode it.
  1412.       if test "$hardcode_direct" = yes; then
  1413.         finalize_command="$finalize_command $libdir/$linklib"
  1414.       elif test "$hardcode_minus_L" = yes; then
  1415.         case "$finalize_command " in
  1416.         *" -L$libdir "*) ;;
  1417.         *) finalize_command="$finalize_command -L$libdir";;
  1418.         esac
  1419.         finalize_command="$finalize_command -l$name"
  1420.       elif test "$hardcode_shlibpath_var" = yes; then
  1421.         case ":$finalize_shlibpath:" in
  1422.         *":$libdir:"*) ;;
  1423.         *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1424.         esac
  1425.         finalize_command="$finalize_command -l$name"
  1426.       else
  1427.         # We cannot seem to hardcode it, guess we'll fake it.
  1428.         case "$finalize_command " in
  1429.         *" -L$dir "*) ;;
  1430.         *) finalize_command="$finalize_command -L$libdir";;
  1431.         esac
  1432.         finalize_command="$finalize_command -l$name"
  1433.       fi
  1434.     else
  1435.       # Transform directly to old archives if we don't build new libraries.
  1436.       if test -n "$pic_flag" && test -z "$old_library"; then
  1437.         $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1438.         exit 1
  1439.       fi
  1440.  
  1441.       # Here we assume that one of hardcode_direct or hardcode_minus_L
  1442.       # is not unsupported.  This is valid on all known static and
  1443.       # shared platforms.
  1444.       if test "$hardcode_direct" != unsupported; then
  1445.         test -n "$old_library" && linklib="$old_library"
  1446.         compile_command="$compile_command $dir/$linklib"
  1447.         finalize_command="$finalize_command $dir/$linklib"
  1448.       else
  1449.         case "$compile_command " in
  1450.         *" -L$dir "*) ;;
  1451.         *) compile_command="$compile_command -L$dir";;
  1452.         esac
  1453.         compile_command="$compile_command -l$name"
  1454.         case "$finalize_command " in
  1455.         *" -L$dir "*) ;;
  1456.         *) finalize_command="$finalize_command -L$dir";;
  1457.         esac
  1458.         finalize_command="$finalize_command -l$name"
  1459.       fi
  1460.     fi
  1461.  
  1462.     # Add in any libraries that this one depends upon.
  1463.     compile_command="$compile_command$dependency_libs"
  1464.     finalize_command="$finalize_command$dependency_libs"
  1465.     continue
  1466.     ;;
  1467.  
  1468.       # Some other compiler argument.
  1469.       *)
  1470.     # Unknown arguments in both finalize_command and compile_command need
  1471.     # to be aesthetically quoted because they are evaled later.
  1472.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1473.     case "$arg" in
  1474.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1475.       arg="\"$arg\""
  1476.       ;;
  1477.     esac
  1478.     ;;
  1479.       esac
  1480.  
  1481.       # Now actually substitute the argument into the commands.
  1482.       if test -n "$arg"; then
  1483.     compile_command="$compile_command $arg"
  1484.     finalize_command="$finalize_command $arg"
  1485.       fi
  1486.     done
  1487.  
  1488.     if test -n "$prev"; then
  1489.       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1490.       $echo "$help" 1>&2
  1491.       exit 1
  1492.     fi
  1493.  
  1494.     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1495.       eval arg=\"$export_dynamic_flag_spec\"
  1496.       compile_command="$compile_command $arg"
  1497.       finalize_command="$finalize_command $arg"
  1498.     fi
  1499.  
  1500.     oldlibs=
  1501.     # calculate the name of the file, without its directory
  1502.     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1503.     libobjs_save="$libobjs"
  1504.  
  1505.     case "$output" in
  1506.     "")
  1507.       $echo "$modename: you must specify an output file" 1>&2
  1508.       $echo "$help" 1>&2
  1509.       exit 1
  1510.       ;;
  1511.  
  1512.     *.a | *.lib)
  1513.       if test -n "$link_against_libtool_libs"; then
  1514.     $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1515.     exit 1
  1516.       fi
  1517.  
  1518.       if test -n "$deplibs"; then
  1519.     $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1520.       fi
  1521.  
  1522.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1523.     $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1524.       fi
  1525.  
  1526.       if test -n "$rpath"; then
  1527.     $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1528.       fi
  1529.  
  1530.       if test -n "$xrpath"; then
  1531.     $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1532.       fi
  1533.  
  1534.       if test -n "$vinfo"; then
  1535.     $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1536.       fi
  1537.  
  1538.       if test -n "$release"; then
  1539.     $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1540.       fi
  1541.  
  1542.       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1543.     $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1544.       fi
  1545.  
  1546.       # Now set the variables for building old libraries.
  1547.       build_libtool_libs=no
  1548.       oldlibs="$output"
  1549.       ;;
  1550.  
  1551.     *.la)
  1552.       # Make sure we only generate libraries of the form `libNAME.la'.
  1553.       case "$outputname" in
  1554.       lib*)
  1555.     name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1556.     eval libname=\"$libname_spec\"
  1557.     ;;
  1558.       *)
  1559.     if test "$module" = no; then
  1560.       $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1561.       $echo "$help" 1>&2
  1562.       exit 1
  1563.     fi
  1564.     if test "$need_lib_prefix" != no; then
  1565.       # Add the "lib" prefix for modules if required
  1566.       name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1567.       eval libname=\"$libname_spec\"
  1568.     else
  1569.       libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1570.     fi
  1571.     ;;
  1572.       esac
  1573.  
  1574.       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1575.       if test "X$output_objdir" = "X$output"; then
  1576.     output_objdir="$objdir"
  1577.       else
  1578.     output_objdir="$output_objdir/$objdir"
  1579.       fi
  1580.  
  1581.       if test -n "$objs"; then
  1582.     $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1583.     exit 1
  1584.       fi
  1585.  
  1586.       # How the heck are we supposed to write a wrapper for a shared library?
  1587.       if test -n "$link_against_libtool_libs"; then
  1588.      $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1589.      exit 1
  1590.       fi
  1591.  
  1592.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1593.     $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1594.       fi
  1595.  
  1596.       set dummy $rpath
  1597.       if test $# -gt 2; then
  1598.     $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1599.       fi
  1600.       install_libdir="$2"
  1601.  
  1602.       oldlibs=
  1603.       if test -z "$rpath"; then
  1604.     if test "$build_libtool_libs" = yes; then
  1605.       # Building a libtool convenience library.
  1606.       libext=al
  1607.       oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1608.       build_libtool_libs=convenience
  1609.       build_old_libs=yes
  1610.     fi
  1611.     dependency_libs="$deplibs"
  1612.  
  1613.     if test -n "$vinfo"; then
  1614.       $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1615.     fi
  1616.  
  1617.     if test -n "$release"; then
  1618.       $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1619.     fi
  1620.       else
  1621.  
  1622.     # Parse the version information argument.
  1623.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
  1624.     set dummy $vinfo 0 0 0
  1625.     IFS="$save_ifs"
  1626.  
  1627.     if test -n "$8"; then
  1628.       $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1629.       $echo "$help" 1>&2
  1630.       exit 1
  1631.     fi
  1632.  
  1633.     current="$2"
  1634.     revision="$3"
  1635.     age="$4"
  1636.  
  1637.     # Check that each of the things are valid numbers.
  1638.     case "$current" in
  1639.     0 | [1-9] | [1-9][0-9]*) ;;
  1640.     *)
  1641.       $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1642.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1643.       exit 1
  1644.       ;;
  1645.     esac
  1646.  
  1647.     case "$revision" in
  1648.     0 | [1-9] | [1-9][0-9]*) ;;
  1649.     *)
  1650.       $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1651.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1652.       exit 1
  1653.       ;;
  1654.     esac
  1655.  
  1656.     case "$age" in
  1657.     0 | [1-9] | [1-9][0-9]*) ;;
  1658.     *)
  1659.       $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1660.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1661.       exit 1
  1662.       ;;
  1663.     esac
  1664.  
  1665.     if test $age -gt $current; then
  1666.       $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1667.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1668.       exit 1
  1669.     fi
  1670.  
  1671.     # Calculate the version variables.
  1672.     major=
  1673.     versuffix=
  1674.     verstring=
  1675.     case "$version_type" in
  1676.     none) ;;
  1677.  
  1678.     irix)
  1679.       major=`expr $current - $age + 1`
  1680.       versuffix="$major.$revision"
  1681.       verstring="sgi$major.$revision"
  1682.  
  1683.       # Add in all the interfaces that we are compatible with.
  1684.       loop=$revision
  1685.       while test $loop != 0; do
  1686.         iface=`expr $revision - $loop`
  1687.         loop=`expr $loop - 1`
  1688.         verstring="sgi$major.$iface:$verstring"
  1689.       done
  1690.       ;;
  1691.  
  1692.     linux)
  1693.       major=.`expr $current - $age`
  1694.       versuffix="$major.$age.$revision"
  1695.       ;;
  1696.  
  1697.     osf)
  1698.       major=`expr $current - $age`
  1699.       versuffix=".$current.$age.$revision"
  1700.       verstring="$current.$age.$revision"
  1701.  
  1702.       # Add in all the interfaces that we are compatible with.
  1703.       loop=$age
  1704.       while test $loop != 0; do
  1705.         iface=`expr $current - $loop`
  1706.         loop=`expr $loop - 1`
  1707.         verstring="$verstring:${iface}.0"
  1708.       done
  1709.  
  1710.       # Make executables depend on our current version.
  1711.       verstring="$verstring:${current}.0"
  1712.       ;;
  1713.  
  1714.     sunos)
  1715.       major=".$current"
  1716.       versuffix=".$current.$revision"
  1717.       ;;
  1718.  
  1719.     freebsd-aout)
  1720.       major=".$current"
  1721.       versuffix=".$current.$revision";
  1722.       ;;
  1723.  
  1724.     freebsd-elf)
  1725.       major=".$current"
  1726.       versuffix=".$current";
  1727.       ;;
  1728.  
  1729.     windows)
  1730.       # Like Linux, but with '-' rather than '.', since we only
  1731.       # want one extension on Windows 95.
  1732.       major=`expr $current - $age`
  1733.       versuffix="-$major-$age-$revision"
  1734.       ;;
  1735.  
  1736.     *)
  1737.       $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1738.       echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1739.       exit 1
  1740.       ;;
  1741.     esac
  1742.  
  1743.     # Clear the version info if we defaulted, and they specified a release.
  1744.     if test -z "$vinfo" && test -n "$release"; then
  1745.       major=
  1746.       verstring="0.0"
  1747.       if test "$need_version" = no; then
  1748.         versuffix=
  1749.       else
  1750.         versuffix=".0.0"
  1751.       fi
  1752.     fi
  1753.  
  1754.     # Remove version info from name if versioning should be avoided
  1755.     if test "$avoid_version" = yes && test "$need_version" = no; then
  1756.       major=
  1757.       versuffix=
  1758.       verstring=""
  1759.     fi
  1760.     
  1761.     # Check to see if the archive will have undefined symbols.
  1762.     if test "$allow_undefined" = yes; then
  1763.       if test "$allow_undefined_flag" = unsupported; then
  1764.         $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1765.         build_libtool_libs=no
  1766.         build_old_libs=yes
  1767.       fi
  1768.     else
  1769.       # Don't allow undefined symbols.
  1770.       allow_undefined_flag="$no_undefined_flag"
  1771.     fi
  1772.  
  1773.     dependency_libs="$deplibs"
  1774.     case "$host" in
  1775.     *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1776.       # these systems don't actually have a c library (as such)!
  1777.       ;;
  1778.     *)
  1779.       # Add libc to deplibs on all other systems.
  1780.       deplibs="$deplibs -lc"
  1781.       ;;
  1782.     esac
  1783.       fi
  1784.  
  1785.       # Create the output directory, or remove our outputs if we need to.
  1786.       if test -d $output_objdir; then
  1787.     $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1788.     $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1789.       else
  1790.     $show "$mkdir $output_objdir"
  1791.     $run $mkdir $output_objdir
  1792.     status=$?
  1793.     if test $status -ne 0 && test ! -d $output_objdir; then
  1794.       exit $status
  1795.     fi
  1796.       fi
  1797.  
  1798.       # Now set the variables for building old libraries.
  1799.       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1800.     oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1801.  
  1802.     # Transform .lo files to .o files.
  1803.     oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1804.       fi
  1805.  
  1806.       if test "$build_libtool_libs" = yes; then
  1807.     # Transform deplibs into only deplibs that can be linked in shared.
  1808.     name_save=$name
  1809.     libname_save=$libname
  1810.     release_save=$release
  1811.     versuffix_save=$versuffix
  1812.     major_save=$major
  1813.     # I'm not sure if I'm treating the release correctly.  I think
  1814.     # release should show up in the -l (ie -lgmp5) so we don't want to
  1815.     # add it in twice.  Is that correct?
  1816.     release=""
  1817.     versuffix=""
  1818.     major=""
  1819.     newdeplibs=
  1820.     droppeddeps=no
  1821.     case "$deplibs_check_method" in
  1822.     pass_all)
  1823.       # Don't check for shared/static.  Everything works.
  1824.       # This might be a little naive.  We might want to check
  1825.       # whether the library exists or not.  But this is on
  1826.       # osf3 & osf4 and I'm not really sure... Just
  1827.       # implementing what was already the behaviour.
  1828.       newdeplibs=$deplibs
  1829.       ;;
  1830.     test_compile)
  1831.       # This code stresses the "libraries are programs" paradigm to its
  1832.       # limits. Maybe even breaks it.  We compile a program, linking it
  1833.       # against the deplibs as a proxy for the library.  Then we can check
  1834.       # whether they linked in statically or dynamically with ldd.
  1835.       $rm conftest.c
  1836.       cat > conftest.c <<EOF
  1837.       int main() { return 0; }
  1838. EOF
  1839.       $rm conftest
  1840.       $CC -o conftest conftest.c $deplibs
  1841.       if test $? -eq 0 ; then
  1842.         ldd_output=`ldd conftest`
  1843.         for i in $deplibs; do
  1844.           name="`expr $i : '-l\(.*\)'`"
  1845.           # If $name is empty we are operating on a -L argument.
  1846.           if test "$name" != "" ; then
  1847.         libname=`eval \\$echo \"$libname_spec\"`
  1848.         deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1849.         set dummy $deplib_matches
  1850.         deplib_match=$2
  1851.         if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1852.           newdeplibs="$newdeplibs $i"
  1853.         else
  1854.           droppeddeps=yes
  1855.           echo
  1856.           echo "*** Warning: This library needs some functionality provided by $i."
  1857.           echo "*** I have the capability to make that library automatically link in when"
  1858.           echo "*** you link to this library.  But I can only do this if you have a"
  1859.           echo "*** shared version of the library, which you do not appear to have."
  1860.         fi
  1861.           else
  1862.         newdeplibs="$newdeplibs $i"
  1863.           fi
  1864.         done
  1865.       else
  1866.         # Error occured in the first compile.  Let's try to salvage the situation:
  1867.         # Compile a seperate program for each library.
  1868.         for i in $deplibs; do
  1869.           name="`expr $i : '-l\(.*\)'`"
  1870.          # If $name is empty we are operating on a -L argument.
  1871.           if test "$name" != "" ; then
  1872.         $rm conftest
  1873.         $CC -o conftest conftest.c $i
  1874.         # Did it work?
  1875.         if test $? -eq 0 ; then
  1876.           ldd_output=`ldd conftest`
  1877.           libname=`eval \\$echo \"$libname_spec\"`
  1878.           deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1879.           set dummy $deplib_matches
  1880.           deplib_match=$2
  1881.           if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1882.             newdeplibs="$newdeplibs $i"
  1883.           else
  1884.             droppeddeps=yes
  1885.             echo
  1886.             echo "*** Warning: This library needs some functionality provided by $i."
  1887.             echo "*** I have the capability to make that library automatically link in when"
  1888.             echo "*** you link to this library.  But I can only do this if you have a"
  1889.             echo "*** shared version of the library, which you do not appear to have."
  1890.           fi
  1891.         else
  1892.           droppeddeps=yes
  1893.           echo
  1894.           echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1895.           echo "***  make it link in!  You will probably need to install it or some"
  1896.           echo "*** library that it depends on before this library will be fully"
  1897.           echo "*** functional.  Installing it before continuing would be even better."
  1898.         fi
  1899.           else
  1900.         newdeplibs="$newdeplibs $i"
  1901.           fi
  1902.         done
  1903.       fi
  1904.       ;;
  1905.     file_magic*)
  1906.       set dummy $deplibs_check_method
  1907.       file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1908.       for a_deplib in $deplibs; do
  1909.         name="`expr $a_deplib : '-l\(.*\)'`"
  1910.         # If $name is empty we are operating on a -L argument.
  1911.         if test "$name" != "" ; then
  1912.           libname=`eval \\$echo \"$libname_spec\"`
  1913.           for i in $lib_search_path; do
  1914.             potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1915.             for potent_lib in $potential_libs; do
  1916.               # Follow soft links.
  1917.               if ls -lLd "$potent_lib" 2>/dev/null \
  1918.              | grep " -> " >/dev/null; then
  1919.             continue 
  1920.               fi
  1921.               # The statement above tries to avoid entering an
  1922.               # endless loop below, in case of cyclic links.
  1923.               # We might still enter an endless loop, since a link
  1924.               # loop can be closed while we follow links,
  1925.               # but so what?
  1926.               potlib="$potent_lib"
  1927.               while test -h "$potlib" 2>/dev/null; do
  1928.             potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  1929.             case "$potliblink" in
  1930.             [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  1931.             *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  1932.             esac
  1933.               done
  1934.               if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  1935.              | sed 10q \
  1936.              | egrep "$file_magic_regex" > /dev/null; then
  1937.             newdeplibs="$newdeplibs $a_deplib"
  1938.             a_deplib=""
  1939.             break 2
  1940.               fi
  1941.             done
  1942.           done
  1943.           if test -n "$a_deplib" ; then
  1944.         droppeddeps=yes
  1945.         echo
  1946.         echo "*** Warning: This library needs some functionality provided by $a_deplib."
  1947.         echo "*** I have the capability to make that library automatically link in when"
  1948.         echo "*** you link to this library.  But I can only do this if you have a"
  1949.         echo "*** shared version of the library, which you do not appear to have."
  1950.           fi
  1951.         else
  1952.           # Add a -L argument.
  1953.           newdeplibs="$newdeplibs $a_deplib"
  1954.         fi
  1955.       done # Gone through all deplibs.
  1956.       ;;
  1957.     none | unknown | *)
  1958.       newdeplibs=""
  1959.       if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1960.            -e 's/ -[LR][^ ]*//g' -e 's/[     ]//g' |
  1961.          grep . >/dev/null; then
  1962.         echo
  1963.         if test "X$deplibs_check_method" = "Xnone"; then
  1964.           echo "*** Warning: inter-library dependencies are not supported in this platform."
  1965.         else
  1966.           echo "*** Warning: inter-library dependencies are not known to be supported."
  1967.         fi
  1968.         echo "*** All declared inter-library dependencies are being dropped."
  1969.         droppeddeps=yes
  1970.       fi
  1971.       ;;
  1972.     esac
  1973.     versuffix=$versuffix_save
  1974.     major=$major_save
  1975.     release=$release_save
  1976.     libname=$libname_save
  1977.     name=$name_save
  1978.  
  1979.     if test "$droppeddeps" = yes; then
  1980.       if test "$module" = yes; then
  1981.         echo
  1982.         echo "*** Warning: libtool could not satisfy all declared inter-library"
  1983.         echo "*** dependencies of module $libname.  Therefore, libtool will create"
  1984.         echo "*** a static module, that should work as long as the dlopening"
  1985.         echo "*** application is linked with the -dlopen flag."
  1986.         if test -z "$global_symbol_pipe"; then
  1987.           echo
  1988.           echo "*** However, this would only work if libtool was able to extract symbol"
  1989.           echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1990.           echo "*** not find such a program.  So, this module is probably useless."
  1991.           echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1992.         fi
  1993.         if test "$build_old_libs" = no; then
  1994.           oldlibs="$output_objdir/$libname.$libext"
  1995.           build_libtool_libs=module
  1996.           build_old_libs=yes
  1997.         else
  1998.           build_libtool_libs=no
  1999.         fi
  2000.       else
  2001.         echo "*** The inter-library dependencies that have been dropped here will be"
  2002.         echo "*** automatically added whenever a program is linked with this library"
  2003.         echo "*** or is declared to -dlopen it."
  2004.       fi
  2005.     fi
  2006.     # Done checking deplibs!
  2007.     deplibs=$newdeplibs
  2008.       fi
  2009.  
  2010.       # All the library-specific variables (install_libdir is set above).
  2011.       library_names=
  2012.       old_library=
  2013.       dlname=
  2014.       
  2015.       # Test again, we may have decided not to build it any more
  2016.       if test "$build_libtool_libs" = yes; then
  2017.     # Get the real and link names of the library.
  2018.     eval library_names=\"$library_names_spec\"
  2019.     set dummy $library_names
  2020.     realname="$2"
  2021.     shift; shift
  2022.  
  2023.     if test -n "$soname_spec"; then
  2024.       eval soname=\"$soname_spec\"
  2025.     else
  2026.       soname="$realname"
  2027.     fi
  2028.  
  2029.     lib="$output_objdir/$realname"
  2030.     for link
  2031.     do
  2032.       linknames="$linknames $link"
  2033.     done
  2034.  
  2035.     # Ensure that we have .o objects for linkers which dislike .lo
  2036.     # (e.g. aix) in case we are running --disable-static
  2037.     for obj in $libobjs; do
  2038.       xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  2039.       if test "X$xdir" = "X$obj"; then
  2040.         xdir="."
  2041.       else
  2042.         xdir="$xdir"
  2043.       fi
  2044.       baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  2045.       oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2046.       if test ! -f $xdir/$oldobj; then
  2047.         $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
  2048.         $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
  2049.       fi
  2050.     done
  2051.  
  2052.     # Use standard objects if they are pic
  2053.     test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2054.  
  2055.     # Prepare the list of exported symbols
  2056.     if test -z "$export_symbols"; then
  2057.       if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  2058.         $show "generating symbol list for \`$libname.la'"
  2059.         export_symbols="$output_objdir/$libname.exp"
  2060.         $run $rm $export_symbols
  2061.         eval cmds=\"$export_symbols_cmds\"
  2062.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2063.         for cmd in $cmds; do
  2064.           IFS="$save_ifs"
  2065.           $show "$cmd"
  2066.           $run eval "$cmd" || exit $?
  2067.         done
  2068.         IFS="$save_ifs"
  2069.         if test -n "$export_symbols_regex"; then
  2070.           $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  2071.           $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  2072.           $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  2073.           $run eval '$mv "${export_symbols}T" "$export_symbols"'
  2074.         fi
  2075.       fi
  2076.     fi
  2077.  
  2078.     if test -n "$export_symbols" && test -n "$include_expsyms"; then
  2079.       $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  2080.     fi
  2081.  
  2082.     if test -n "$convenience"; then
  2083.       if test -n "$whole_archive_flag_spec"; then
  2084.         eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  2085.       else
  2086.         gentop="$output_objdir/${outputname}x"
  2087.         $show "${rm}r $gentop"
  2088.         $run ${rm}r "$gentop"
  2089.         $show "mkdir $gentop"
  2090.         $run mkdir "$gentop"
  2091.         status=$?
  2092.         if test $status -ne 0 && test ! -d "$gentop"; then
  2093.           exit $status
  2094.         fi
  2095.         generated="$generated $gentop"
  2096.  
  2097.         for xlib in $convenience; do
  2098.           # Extract the objects.
  2099.           case "$xlib" in
  2100.           [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2101.           *) xabs=`pwd`"/$xlib" ;;
  2102.           esac
  2103.           xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2104.           xdir="$gentop/$xlib"
  2105.  
  2106.           $show "${rm}r $xdir"
  2107.           $run ${rm}r "$xdir"
  2108.           $show "mkdir $xdir"
  2109.           $run mkdir "$xdir"
  2110.           status=$?
  2111.           if test $status -ne 0 && test ! -d "$xdir"; then
  2112.         exit $status
  2113.           fi
  2114.           $show "(cd $xdir && $AR x $xabs)"
  2115.           $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2116.  
  2117.           libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2118.         done
  2119.       fi
  2120.     fi
  2121.  
  2122.     if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  2123.       eval flag=\"$thread_safe_flag_spec\"
  2124.       linkopts="$linkopts $flag"
  2125.     fi
  2126.  
  2127.     # Do each of the archive commands.
  2128.     if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  2129.       eval cmds=\"$archive_expsym_cmds\"
  2130.     else
  2131.       eval cmds=\"$archive_cmds\"
  2132.     fi
  2133.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2134.     for cmd in $cmds; do
  2135.       IFS="$save_ifs"
  2136.       $show "$cmd"
  2137.       $run eval "$cmd" || exit $?
  2138.     done
  2139.     IFS="$save_ifs"
  2140.  
  2141.     # Create links to the real library.
  2142.     for linkname in $linknames; do
  2143.       if test "$realname" != "$linkname"; then
  2144.         $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  2145.         $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  2146.       fi
  2147.     done
  2148.  
  2149.     # If -module or -export-dynamic was specified, set the dlname.
  2150.     if test "$module" = yes || test "$export_dynamic" = yes; then
  2151.       # On all known operating systems, these are identical.
  2152.       dlname="$soname"
  2153.     fi
  2154.       fi
  2155.       ;;
  2156.  
  2157.     *.lo | *.o | *.obj)
  2158.       if test -n "$link_against_libtool_libs"; then
  2159.     $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  2160.     exit 1
  2161.       fi
  2162.  
  2163.       if test -n "$deplibs"; then
  2164.     $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  2165.       fi
  2166.  
  2167.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2168.     $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  2169.       fi
  2170.  
  2171.       if test -n "$rpath"; then
  2172.     $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  2173.       fi
  2174.  
  2175.       if test -n "$xrpath"; then
  2176.     $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  2177.       fi
  2178.  
  2179.       if test -n "$vinfo"; then
  2180.     $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  2181.       fi
  2182.  
  2183.       if test -n "$release"; then
  2184.     $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  2185.       fi
  2186.  
  2187.       case "$output" in
  2188.       *.lo)
  2189.     if test -n "$objs"; then
  2190.       $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  2191.       exit 1
  2192.     fi
  2193.     libobj="$output"
  2194.     obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  2195.     ;;
  2196.       *)
  2197.     libobj=
  2198.     obj="$output"
  2199.     ;;
  2200.       esac
  2201.  
  2202.       # Delete the old objects.
  2203.       $run $rm $obj $libobj
  2204.  
  2205.       # Objects from convenience libraries.  This assumes
  2206.       # single-version convenience libraries.  Whenever we create
  2207.       # different ones for PIC/non-PIC, this we'll have to duplicate
  2208.       # the extraction.
  2209.       reload_conv_objs=
  2210.       gentop=
  2211.       # reload_cmds runs $LD directly, so let us get rid of
  2212.       # -Wl from whole_archive_flag_spec
  2213.       wl= 
  2214.  
  2215.       if test -n "$convenience"; then
  2216.     if test -n "$whole_archive_flag_spec"; then
  2217.       eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  2218.     else
  2219.       gentop="$output_objdir/${obj}x"
  2220.       $show "${rm}r $gentop"
  2221.       $run ${rm}r "$gentop"
  2222.       $show "mkdir $gentop"
  2223.       $run mkdir "$gentop"
  2224.       status=$?
  2225.       if test $status -ne 0 && test ! -d "$gentop"; then
  2226.         exit $status
  2227.       fi
  2228.       generated="$generated $gentop"
  2229.  
  2230.       for xlib in $convenience; do
  2231.         # Extract the objects.
  2232.         case "$xlib" in
  2233.         [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2234.         *) xabs=`pwd`"/$xlib" ;;
  2235.         esac
  2236.         xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2237.         xdir="$gentop/$xlib"
  2238.  
  2239.         $show "${rm}r $xdir"
  2240.         $run ${rm}r "$xdir"
  2241.         $show "mkdir $xdir"
  2242.         $run mkdir "$xdir"
  2243.         status=$?
  2244.         if test $status -ne 0 && test ! -d "$xdir"; then
  2245.           exit $status
  2246.         fi
  2247.         $show "(cd $xdir && $AR x $xabs)"
  2248.         $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2249.  
  2250.         reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2251.       done
  2252.     fi
  2253.       fi
  2254.  
  2255.       # Create the old-style object.
  2256.       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  2257.  
  2258.       output="$obj"
  2259.       eval cmds=\"$reload_cmds\"
  2260.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2261.       for cmd in $cmds; do
  2262.     IFS="$save_ifs"
  2263.     $show "$cmd"
  2264.     $run eval "$cmd" || exit $?
  2265.       done
  2266.       IFS="$save_ifs"
  2267.  
  2268.       # Exit if we aren't doing a library object file.
  2269.       if test -z "$libobj"; then
  2270.     if test -n "$gentop"; then
  2271.       $show "${rm}r $gentop"
  2272.       $run ${rm}r $gentop
  2273.     fi
  2274.  
  2275.     exit 0
  2276.       fi
  2277.  
  2278.       if test "$build_libtool_libs" != yes; then
  2279.     if test -n "$gentop"; then
  2280.       $show "${rm}r $gentop"
  2281.       $run ${rm}r $gentop
  2282.     fi
  2283.  
  2284.     # Create an invalid libtool object if no PIC, so that we don't
  2285.     # accidentally link it into a program.
  2286.     $show "echo timestamp > $libobj"
  2287.     $run eval "echo timestamp > $libobj" || exit $?
  2288.     exit 0
  2289.       fi
  2290.  
  2291.       if test -n "$pic_flag"; then
  2292.     # Only do commands if we really have different PIC objects.
  2293.     reload_objs="$libobjs $reload_conv_objs"
  2294.     output="$libobj"
  2295.     eval cmds=\"$reload_cmds\"
  2296.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2297.     for cmd in $cmds; do
  2298.       IFS="$save_ifs"
  2299.       $show "$cmd"
  2300.       $run eval "$cmd" || exit $?
  2301.     done
  2302.     IFS="$save_ifs"
  2303.       else
  2304.     # Just create a symlink.
  2305.     $show $rm $libobj
  2306.     $run $rm $libobj
  2307.     xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  2308.     if test "X$xdir" = "X$libobj"; then
  2309.       xdir="."
  2310.     else
  2311.       xdir="$xdir"
  2312.     fi
  2313.     baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  2314.     oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2315.     $show "(cd $xdir && $LN_S $oldobj $baseobj)"
  2316.     $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
  2317.       fi
  2318.  
  2319.       if test -n "$gentop"; then
  2320.     $show "${rm}r $gentop"
  2321.     $run ${rm}r $gentop
  2322.       fi
  2323.  
  2324.       exit 0
  2325.       ;;
  2326.  
  2327.     # Anything else should be a program.
  2328.     *)
  2329.       if test -n "$vinfo"; then
  2330.     $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  2331.       fi
  2332.  
  2333.       if test -n "$release"; then
  2334.     $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  2335.       fi
  2336.  
  2337.       if test "$preload" = yes; then
  2338.     if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  2339.        test "$dlopen_self_static" = unknown; then
  2340.       $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  2341.     fi 
  2342.       fi
  2343.     
  2344.       if test -n "$rpath$xrpath"; then
  2345.     # If the user specified any rpath flags, then add them.
  2346.     for libdir in $rpath $xrpath; do
  2347.       # This is the magic to use -rpath.
  2348.       case "$compile_rpath " in
  2349.       *" $libdir "*) ;;
  2350.       *) compile_rpath="$compile_rpath $libdir" ;;
  2351.       esac
  2352.       case "$finalize_rpath " in
  2353.       *" $libdir "*) ;;
  2354.       *) finalize_rpath="$finalize_rpath $libdir" ;;
  2355.       esac
  2356.     done
  2357.       fi
  2358.  
  2359.       # Now hardcode the library paths
  2360.       rpath=
  2361.       hardcode_libdirs=
  2362.       for libdir in $compile_rpath $finalize_rpath; do
  2363.     if test -n "$hardcode_libdir_flag_spec"; then
  2364.       if test -n "$hardcode_libdir_separator"; then
  2365.         if test -z "$hardcode_libdirs"; then
  2366.           hardcode_libdirs="$libdir"
  2367.         else
  2368.           # Just accumulate the unique libdirs.
  2369.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2370.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2371.         ;;
  2372.           *)
  2373.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2374.         ;;
  2375.           esac
  2376.         fi
  2377.       else
  2378.         eval flag=\"$hardcode_libdir_flag_spec\"
  2379.         rpath="$rpath $flag"
  2380.       fi
  2381.     elif test -n "$runpath_var"; then
  2382.       case "$perm_rpath " in
  2383.       *" $libdir "*) ;;
  2384.       *) perm_rpath="$perm_rpath $libdir" ;;
  2385.       esac
  2386.     fi
  2387.       done
  2388.       # Substitute the hardcoded libdirs into the rpath.
  2389.       if test -n "$hardcode_libdir_separator" &&
  2390.      test -n "$hardcode_libdirs"; then
  2391.     libdir="$hardcode_libdirs"
  2392.     eval rpath=\" $hardcode_libdir_flag_spec\"
  2393.       fi
  2394.       compile_rpath="$rpath"
  2395.  
  2396.       rpath=
  2397.       hardcode_libdirs=
  2398.       for libdir in $finalize_rpath; do
  2399.     if test -n "$hardcode_libdir_flag_spec"; then
  2400.       if test -n "$hardcode_libdir_separator"; then
  2401.         if test -z "$hardcode_libdirs"; then
  2402.           hardcode_libdirs="$libdir"
  2403.         else
  2404.           # Just accumulate the unique libdirs.
  2405.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2406.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2407.         ;;
  2408.           *)
  2409.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2410.         ;;
  2411.           esac
  2412.         fi
  2413.       else
  2414.         eval flag=\"$hardcode_libdir_flag_spec\"
  2415.         rpath="$rpath $flag"
  2416.       fi
  2417.     elif test -n "$runpath_var"; then
  2418.       case "$finalize_perm_rpath " in
  2419.       *" $libdir "*) ;;
  2420.       *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  2421.       esac
  2422.     fi
  2423.       done
  2424.       # Substitute the hardcoded libdirs into the rpath.
  2425.       if test -n "$hardcode_libdir_separator" &&
  2426.      test -n "$hardcode_libdirs"; then
  2427.     libdir="$hardcode_libdirs"
  2428.     eval rpath=\" $hardcode_libdir_flag_spec\"
  2429.       fi
  2430.       finalize_rpath="$rpath"
  2431.  
  2432.       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  2433.       if test "X$output_objdir" = "X$output"; then
  2434.     output_objdir="$objdir"
  2435.       else
  2436.     output_objdir="$output_objdir/$objdir"
  2437.       fi
  2438.  
  2439.       # Create the binary in the object directory, then wrap it.
  2440.       if test ! -d $output_objdir; then
  2441.     $show "$mkdir $output_objdir"
  2442.     $run $mkdir $output_objdir
  2443.     status=$?
  2444.     if test $status -ne 0 && test ! -d $output_objdir; then
  2445.       exit $status
  2446.     fi
  2447.       fi
  2448.  
  2449.       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  2450.     # Transform all the library objects into standard objects.
  2451.     compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2452.     finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2453.       fi
  2454.  
  2455.       dlsyms=
  2456.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2457.     if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2458.       dlsyms="${outputname}S.c"
  2459.     else
  2460.       $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  2461.     fi
  2462.       fi
  2463.  
  2464.       if test -n "$dlsyms"; then
  2465.     case "$dlsyms" in
  2466.     "") ;;
  2467.     *.c)
  2468.       # Discover the nlist of each of the dlfiles.
  2469.       nlist="$output_objdir/${outputname}.nm"
  2470.  
  2471.       $show "$rm $nlist ${nlist}S ${nlist}T"
  2472.       $run $rm "$nlist" "${nlist}S" "${nlist}T"
  2473.  
  2474.       # Parse the name list into a source file.
  2475.       $show "creating $output_objdir/$dlsyms"
  2476.  
  2477.       test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  2478. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  2479. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  2480.  
  2481. #ifdef __cplusplus
  2482. extern \"C\" {
  2483. #endif
  2484.  
  2485. /* Prevent the only kind of declaration conflicts we can make. */
  2486. #define lt_preloaded_symbols some_other_symbol
  2487.  
  2488. /* External symbol declarations for the compiler. */\
  2489. "
  2490.  
  2491.       if test "$dlself" = yes; then
  2492.         $show "generating symbol list for \`$output'"
  2493.  
  2494.         test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  2495.  
  2496.         # Add our own program objects to the symbol list.
  2497.         progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2498.         for arg in $progfiles; do
  2499.           $show "extracting global C symbols from \`$arg'"
  2500.           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2501.         done
  2502.  
  2503.         if test -n "$exclude_expsyms"; then
  2504.           $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2505.           $run eval '$mv "$nlist"T "$nlist"'
  2506.         fi
  2507.         
  2508.         if test -n "$export_symbols_regex"; then
  2509.           $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2510.           $run eval '$mv "$nlist"T "$nlist"'
  2511.         fi
  2512.  
  2513.         # Prepare the list of exported symbols
  2514.         if test -z "$export_symbols"; then
  2515.           export_symbols="$output_objdir/$output.exp"
  2516.           $run $rm $export_symbols
  2517.           $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2518.         else
  2519.           $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  2520.           $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  2521.           $run eval 'mv "$nlist"T "$nlist"'
  2522.         fi
  2523.       fi
  2524.  
  2525.       for arg in $dlprefiles; do
  2526.         $show "extracting global C symbols from \`$arg'"
  2527.         name=`echo "$arg" | sed -e 's%^.*/%%'`
  2528.         $run eval 'echo ": $name " >> "$nlist"'
  2529.         $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2530.       done
  2531.  
  2532.       if test -z "$run"; then
  2533.         # Make sure we have at least an empty file.
  2534.         test -f "$nlist" || : > "$nlist"
  2535.  
  2536.         if test -n "$exclude_expsyms"; then
  2537.           egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2538.           $mv "$nlist"T "$nlist"
  2539.         fi
  2540.  
  2541.         # Try sorting and uniquifying the output.
  2542.         if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  2543.           :
  2544.         else
  2545.           grep -v "^: " < "$nlist" > "$nlist"S
  2546.         fi
  2547.  
  2548.         if test -f "$nlist"S; then
  2549.           eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  2550.         else
  2551.           echo '/* NONE */' >> "$output_objdir/$dlsyms"
  2552.         fi
  2553.  
  2554.         $echo >> "$output_objdir/$dlsyms" "\
  2555.  
  2556. #undef lt_preloaded_symbols
  2557.  
  2558. #if defined (__STDC__) && __STDC__
  2559. # define lt_ptr_t void *
  2560. #else
  2561. # define lt_ptr_t char *
  2562. # define const
  2563. #endif
  2564.  
  2565. /* The mapping between symbol names and symbols. */
  2566. const struct {
  2567.   const char *name;
  2568.   lt_ptr_t address;
  2569. }
  2570. lt_preloaded_symbols[] =
  2571. {\
  2572. "
  2573.  
  2574.         sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
  2575.         -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
  2576.           < "$nlist" >> "$output_objdir/$dlsyms"
  2577.  
  2578.         $echo >> "$output_objdir/$dlsyms" "\
  2579.   {0, (lt_ptr_t) 0}
  2580. };
  2581.  
  2582. /* This works around a problem in FreeBSD linker */
  2583. #ifdef FREEBSD_WORKAROUND
  2584. static const void *lt_preloaded_setup() {
  2585.   return lt_preloaded_symbols;
  2586. }
  2587. #endif
  2588.  
  2589. #ifdef __cplusplus
  2590. }
  2591. #endif\
  2592. "
  2593.       fi
  2594.  
  2595.       pic_flag_for_symtable=
  2596.       case "$host" in
  2597.       # compiling the symbol table file with pic_flag works around
  2598.       # a FreeBSD bug that causes programs to crash when -lm is
  2599.       # linked before any other PIC object.  But we must not use
  2600.       # pic_flag when linking with -static.  The problem exists in
  2601.       # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2602.       *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  2603.         case "$compile_command " in
  2604.         *" -static "*) ;;
  2605.         *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  2606.         esac;;
  2607.       *-*-hpux*)
  2608.         case "$compile_command " in
  2609.         *" -static "*) ;;
  2610.         *) pic_flag_for_symtable=" $pic_flag -DPIC";;
  2611.         esac
  2612.       esac
  2613.  
  2614.       # Now compile the dynamic symbol file.
  2615.       $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  2616.       $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  2617.  
  2618.       # Clean up the generated files.
  2619.       $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  2620.       $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  2621.  
  2622.       # Transform the symbol file into the correct name.
  2623.       compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2624.       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2625.       ;;
  2626.     *)
  2627.       $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  2628.       exit 1
  2629.       ;;
  2630.     esac
  2631.       else
  2632.     # We keep going just in case the user didn't refer to
  2633.     # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  2634.     # really was required.
  2635.  
  2636.     # Nullify the symbol file.
  2637.     compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2638.     finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2639.       fi
  2640.  
  2641.       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  2642.     # Replace the output file specification.
  2643.     compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  2644.     link_command="$compile_command$compile_rpath"
  2645.  
  2646.     # We have no uninstalled library dependencies, so finalize right now.
  2647.     $show "$link_command"
  2648.     $run eval "$link_command"
  2649.     status=$?
  2650.     
  2651.     # Delete the generated files.
  2652.     if test -n "$dlsyms"; then
  2653.       $show "$rm $output_objdir/${outputname}S.${objext}"
  2654.       $run $rm "$output_objdir/${outputname}S.${objext}"
  2655.     fi
  2656.  
  2657.     exit $status
  2658.       fi
  2659.  
  2660.       if test -n "$shlibpath_var"; then
  2661.     # We should set the shlibpath_var
  2662.     rpath=
  2663.     for dir in $temp_rpath; do
  2664.       case "$dir" in
  2665.       [\\/]* | [A-Za-z]:[\\/]*)
  2666.         # Absolute path.
  2667.         rpath="$rpath$dir:"
  2668.         ;;
  2669.       *)
  2670.         # Relative path: add a thisdir entry.
  2671.         rpath="$rpath\$thisdir/$dir:"
  2672.         ;;
  2673.       esac
  2674.     done
  2675.     temp_rpath="$rpath"
  2676.       fi
  2677.  
  2678.       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  2679.     compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  2680.       fi
  2681.       if test -n "$finalize_shlibpath"; then
  2682.     finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  2683.       fi
  2684.  
  2685.       compile_var=
  2686.       finalize_var=
  2687.       if test -n "$runpath_var"; then
  2688.     if test -n "$perm_rpath"; then
  2689.       # We should set the runpath_var.
  2690.       rpath=
  2691.       for dir in $perm_rpath; do
  2692.         rpath="$rpath$dir:"
  2693.       done
  2694.       compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2695.     fi
  2696.     if test -n "$finalize_perm_rpath"; then
  2697.       # We should set the runpath_var.
  2698.       rpath=
  2699.       for dir in $finalize_perm_rpath; do
  2700.         rpath="$rpath$dir:"
  2701.       done
  2702.       finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2703.     fi
  2704.       fi
  2705.  
  2706.       if test "$hardcode_action" = relink; then
  2707.     # Fast installation is not supported
  2708.     link_command="$compile_var$compile_command$compile_rpath"
  2709.     relink_command="$finalize_var$finalize_command$finalize_rpath"
  2710.     
  2711.     $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  2712.     $echo "$modename: \`$output' will be relinked during installation" 1>&2
  2713.       else
  2714.     if test "$fast_install" != no; then
  2715.       link_command="$finalize_var$compile_command$finalize_rpath"
  2716.       if test "$fast_install" = yes; then
  2717.         relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  2718.       else
  2719.         # fast_install is set to needless
  2720.         relink_command=
  2721.       fi
  2722.     else
  2723.       link_command="$compile_var$compile_command$compile_rpath"
  2724.       relink_command="$finalize_var$finalize_command$finalize_rpath"
  2725.     fi
  2726.       fi
  2727.  
  2728.       # Replace the output file specification.
  2729.       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  2730.       
  2731.       # Delete the old output files.
  2732.       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  2733.  
  2734.       $show "$link_command"
  2735.       $run eval "$link_command" || exit $?
  2736.  
  2737.       # Now create the wrapper script.
  2738.       $show "creating $output"
  2739.  
  2740.       # Quote the relink command for shipping.
  2741.       if test -n "$relink_command"; then
  2742.     relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  2743.       fi
  2744.  
  2745.       # Quote $echo for shipping.
  2746.       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  2747.     case "$0" in
  2748.     [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  2749.     *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  2750.     esac
  2751.     qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  2752.       else
  2753.     qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  2754.       fi
  2755.  
  2756.       # Only actually do things if our run command is non-null.
  2757.       if test -z "$run"; then
  2758.     # win32 will think the script is a binary if it has
  2759.     # a .exe suffix, so we strip it off here.
  2760.     case $output in
  2761.       *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  2762.     esac
  2763.     $rm $output
  2764.     trap "$rm $output; exit 1" 1 2 15
  2765.  
  2766.     $echo > $output "\
  2767. #! $SHELL
  2768.  
  2769. # $output - temporary wrapper script for $objdir/$outputname
  2770. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2771. #
  2772. # The $output program cannot be directly executed until all the libtool
  2773. # libraries that it depends on are installed.
  2774. #
  2775. # This wrapper script should never be moved out of the build directory.
  2776. # If it is, it will not operate correctly.
  2777.  
  2778. # Sed substitution that helps us do robust quoting.  It backslashifies
  2779. # metacharacters that are still active within double-quoted strings.
  2780. Xsed='sed -e 1s/^X//'
  2781. sed_quote_subst='$sed_quote_subst'
  2782.  
  2783. # The HP-UX ksh and POSIX shell print the target directory to stdout
  2784. # if CDPATH is set.
  2785. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  2786.  
  2787. relink_command=\"$relink_command\"
  2788.  
  2789. # This environment variable determines our operation mode.
  2790. if test \"\$libtool_install_magic\" = \"$magic\"; then
  2791.   # install mode needs the following variable:
  2792.   link_against_libtool_libs='$link_against_libtool_libs'
  2793. else
  2794.   # When we are sourced in execute mode, \$file and \$echo are already set.
  2795.   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2796.     echo=\"$qecho\"
  2797.     file=\"\$0\"
  2798.     # Make sure echo works.
  2799.     if test \"X\$1\" = X--no-reexec; then
  2800.       # Discard the --no-reexec flag, and continue.
  2801.       shift
  2802.     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  2803.       # Yippee, \$echo works!
  2804.       :
  2805.     else
  2806.       # Restart under the correct shell, and then maybe \$echo will work.
  2807.       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2808.     fi
  2809.   fi\
  2810. "
  2811.     $echo >> $output "\
  2812.  
  2813.   # Find the directory that this script lives in.
  2814.   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2815.   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2816.  
  2817.   # Follow symbolic links until we get to the real thisdir.
  2818.   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  2819.   while test -n \"\$file\"; do
  2820.     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2821.  
  2822.     # If there was a directory component, then change thisdir.
  2823.     if test \"x\$destdir\" != \"x\$file\"; then
  2824.       case \"\$destdir\" in
  2825.       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  2826.       *) thisdir=\"\$thisdir/\$destdir\" ;;
  2827.       esac
  2828.     fi
  2829.  
  2830.     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2831.     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  2832.   done
  2833.  
  2834.   # Try to get the absolute directory name.
  2835.   absdir=\`cd \"\$thisdir\" && pwd\`
  2836.   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2837. "
  2838.  
  2839.     if test "$fast_install" = yes; then
  2840.       echo >> $output "\
  2841.   program=lt-'$outputname'
  2842.   progdir=\"\$thisdir/$objdir\"
  2843.   
  2844.   if test ! -f \"\$progdir/\$program\" || \\
  2845.      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  2846.        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2847.  
  2848.     file=\"\$\$-\$program\"
  2849.  
  2850.     if test ! -d \"\$progdir\"; then
  2851.       $mkdir \"\$progdir\"
  2852.     else
  2853.       $rm \"\$progdir/\$file\"
  2854.     fi"
  2855.  
  2856.       echo >> $output "\
  2857.  
  2858.     # relink executable if necessary
  2859.     if test -n \"\$relink_command\"; then
  2860.       if (cd \"\$thisdir\" && eval \$relink_command); then :
  2861.       else
  2862.     $rm \"\$progdir/\$file\"
  2863.     exit 1
  2864.       fi
  2865.     fi
  2866.  
  2867.     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2868.     { $rm \"\$progdir/\$program\";
  2869.       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2870.     $rm \"\$progdir/\$file\"
  2871.   fi"
  2872.     else
  2873.       echo >> $output "\
  2874.   program='$outputname'
  2875.   progdir=\"\$thisdir/$objdir\"
  2876. "
  2877.     fi
  2878.  
  2879.     echo >> $output "\
  2880.  
  2881.   if test -f \"\$progdir/\$program\"; then"
  2882.  
  2883.     # Export our shlibpath_var if we have one.
  2884.     if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2885.       $echo >> $output "\
  2886.     # Add our own library path to $shlibpath_var
  2887.     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2888.  
  2889.     # Some systems cannot cope with colon-terminated $shlibpath_var
  2890.     # The second colon is a workaround for a bug in BeOS R4 sed
  2891.     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2892.  
  2893.     export $shlibpath_var
  2894. "
  2895.     fi
  2896.  
  2897.     # fixup the dll searchpath if we need to.
  2898.     if test -n "$dllsearchpath"; then
  2899.       $echo >> $output "\
  2900.     # Add the dll search path components to the executable PATH
  2901.     PATH=$dllsearchpath:\$PATH
  2902. "
  2903.     fi
  2904.  
  2905.     $echo >> $output "\
  2906.     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2907.       # Run the actual program with our arguments.
  2908. "
  2909.     case $host in
  2910.     *-*-cygwin* | *-*-mingw | *-*-os2*)
  2911.       # win32 systems need to use the prog path for dll
  2912.       # lookup to work
  2913.       $echo >> $output "\
  2914.       exec \$progdir\\\\\$program \${1+\"\$@\"}
  2915. "
  2916.       ;;
  2917.     *)
  2918.       $echo >> $output "\
  2919.       # Export the path to the program.
  2920.       PATH=\"\$progdir:\$PATH\"
  2921.       export PATH
  2922.  
  2923.       exec \$program \${1+\"\$@\"}
  2924. "
  2925.       ;;
  2926.     esac
  2927.     $echo >> $output "\
  2928.       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  2929.       exit 1
  2930.     fi
  2931.   else
  2932.     # The program doesn't exist.
  2933.     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  2934.     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  2935.     echo \"See the $PACKAGE documentation for more information.\" 1>&2
  2936.     exit 1
  2937.   fi
  2938. fi\
  2939. "
  2940.     chmod +x $output
  2941.       fi
  2942.       exit 0
  2943.       ;;
  2944.     esac
  2945.  
  2946.     # See if we need to build an old-fashioned archive.
  2947.     for oldlib in $oldlibs; do
  2948.  
  2949.       if test "$build_libtool_libs" = convenience; then
  2950.     oldobjs="$libobjs_save"
  2951.     addlibs="$convenience"
  2952.     build_libtool_libs=no
  2953.       else
  2954.     if test "$build_libtool_libs" = module; then
  2955.       oldobjs="$libobjs_save"
  2956.       build_libtool_libs=no
  2957.     else
  2958.       oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  2959.     fi
  2960.     addlibs="$old_convenience"
  2961.       fi
  2962.  
  2963.       if test -n "$addlibs"; then
  2964.     gentop="$output_objdir/${outputname}x"
  2965.     $show "${rm}r $gentop"
  2966.     $run ${rm}r "$gentop"
  2967.     $show "mkdir $gentop"
  2968.     $run mkdir "$gentop"
  2969.     status=$?
  2970.     if test $status -ne 0 && test ! -d "$gentop"; then
  2971.       exit $status
  2972.     fi
  2973.     generated="$generated $gentop"
  2974.       
  2975.     # Add in members from convenience archives.
  2976.     for xlib in $addlibs; do
  2977.       # Extract the objects.
  2978.       case "$xlib" in
  2979.       [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2980.       *) xabs=`pwd`"/$xlib" ;;
  2981.       esac
  2982.       xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2983.       xdir="$gentop/$xlib"
  2984.  
  2985.       $show "${rm}r $xdir"
  2986.       $run ${rm}r "$xdir"
  2987.       $show "mkdir $xdir"
  2988.       $run mkdir "$xdir"
  2989.       status=$?
  2990.       if test $status -ne 0 && test ! -d "$xdir"; then
  2991.         exit $status
  2992.       fi
  2993.       $show "(cd $xdir && $AR x $xabs)"
  2994.       $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2995.  
  2996.       oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  2997.     done
  2998.       fi
  2999.  
  3000.       # Do each command in the archive commands.
  3001.       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  3002.     eval cmds=\"$old_archive_from_new_cmds\"
  3003.       else
  3004.     # Ensure that we have .o objects in place in case we decided
  3005.     # not to build a shared library, and have fallen back to building
  3006.     # static libs even though --disable-static was passed!
  3007.     for oldobj in $oldobjs; do
  3008.       if test ! -f $oldobj; then
  3009.         xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
  3010.         if test "X$xdir" = "X$oldobj"; then
  3011.           xdir="."
  3012.         else
  3013.           xdir="$xdir"
  3014.         fi
  3015.         baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
  3016.         obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  3017.         $show "(cd $xdir && ${LN_S} $obj $baseobj)"
  3018.         $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
  3019.       fi
  3020.     done
  3021.  
  3022.     eval cmds=\"$old_archive_cmds\"
  3023.       fi
  3024.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3025.       for cmd in $cmds; do
  3026.     IFS="$save_ifs"
  3027.     $show "$cmd"
  3028.     $run eval "$cmd" || exit $?
  3029.       done
  3030.       IFS="$save_ifs"
  3031.     done
  3032.  
  3033.     if test -n "$generated"; then
  3034.       $show "${rm}r$generated"
  3035.       $run ${rm}r$generated
  3036.     fi
  3037.  
  3038.     # Now create the libtool archive.
  3039.     case "$output" in
  3040.     *.la)
  3041.       old_library=
  3042.       test "$build_old_libs" = yes && old_library="$libname.$libext"
  3043.       $show "creating $output"
  3044.  
  3045.       if test -n "$xrpath"; then
  3046.     temp_xrpath=
  3047.     for libdir in $xrpath; do
  3048.       temp_xrpath="$temp_xrpath -R$libdir"
  3049.     done
  3050.     dependency_libs="$temp_xrpath $dependency_libs"
  3051.       fi
  3052.  
  3053.       # Only create the output if not a dry run.
  3054.       if test -z "$run"; then
  3055.     for installed in no yes; do
  3056.       if test "$installed" = yes; then
  3057.         if test -z "$install_libdir"; then
  3058.           break
  3059.         fi
  3060.         output="$output_objdir/$outputname"i
  3061.       fi
  3062.       $rm $output
  3063.       $echo > $output "\
  3064. # $outputname - a libtool library file
  3065. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  3066. #
  3067. # Please DO NOT delete this file!
  3068. # It is necessary for linking the library.
  3069.  
  3070. # The name that we can dlopen(3).
  3071. dlname='$dlname'
  3072.  
  3073. # Names of this library.
  3074. library_names='$library_names'
  3075.  
  3076. # The name of the static archive.
  3077. old_library='$old_library'
  3078.  
  3079. # Libraries that this one depends upon.
  3080. dependency_libs='$dependency_libs'
  3081.  
  3082. # Version information for $libname.
  3083. current=$current
  3084. age=$age
  3085. revision=$revision
  3086.  
  3087. # Is this an already installed library?
  3088. installed=$installed
  3089.  
  3090. # Directory that this library needs to be installed in:
  3091. libdir='$install_libdir'\
  3092. "
  3093.     done
  3094.       fi
  3095.  
  3096.       # Do a symbolic link so that the libtool archive can be found in
  3097.       # LD_LIBRARY_PATH before the program is installed.
  3098.       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  3099.       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  3100.       ;;
  3101.     esac
  3102.     exit 0
  3103.     ;;
  3104.  
  3105.   # libtool install mode
  3106.   install)
  3107.     modename="$modename: install"
  3108.  
  3109.     # There may be an optional sh(1) argument at the beginning of
  3110.     # install_prog (especially on Windows NT).
  3111.     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  3112.       # Aesthetically quote it.
  3113.       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  3114.       case "$arg" in
  3115.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3116.     arg="\"$arg\""
  3117.     ;;
  3118.       esac
  3119.       install_prog="$arg "
  3120.       arg="$1"
  3121.       shift
  3122.     else
  3123.       install_prog=
  3124.       arg="$nonopt"
  3125.     fi
  3126.  
  3127.     # The real first argument should be the name of the installation program.
  3128.     # Aesthetically quote it.
  3129.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3130.     case "$arg" in
  3131.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3132.       arg="\"$arg\""
  3133.       ;;
  3134.     esac
  3135.     install_prog="$install_prog$arg"
  3136.  
  3137.     # We need to accept at least all the BSD install flags.
  3138.     dest=
  3139.     files=
  3140.     opts=
  3141.     prev=
  3142.     install_type=
  3143.     isdir=no
  3144.     stripme=
  3145.     for arg
  3146.     do
  3147.       if test -n "$dest"; then
  3148.     files="$files $dest"
  3149.     dest="$arg"
  3150.     continue
  3151.       fi
  3152.  
  3153.       case "$arg" in
  3154.       -d) isdir=yes ;;
  3155.       -f) prev="-f" ;;
  3156.       -g) prev="-g" ;;
  3157.       -m) prev="-m" ;;
  3158.       -o) prev="-o" ;;
  3159.       -s)
  3160.     stripme=" -s"
  3161.     continue
  3162.     ;;
  3163.       -*) ;;
  3164.  
  3165.       *)
  3166.     # If the previous option needed an argument, then skip it.
  3167.     if test -n "$prev"; then
  3168.       prev=
  3169.     else
  3170.       dest="$arg"
  3171.       continue
  3172.     fi
  3173.     ;;
  3174.       esac
  3175.  
  3176.       # Aesthetically quote the argument.
  3177.       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3178.       case "$arg" in
  3179.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3180.     arg="\"$arg\""
  3181.     ;;
  3182.       esac
  3183.       install_prog="$install_prog $arg"
  3184.     done
  3185.  
  3186.     if test -z "$install_prog"; then
  3187.       $echo "$modename: you must specify an install program" 1>&2
  3188.       $echo "$help" 1>&2
  3189.       exit 1
  3190.     fi
  3191.  
  3192.     if test -n "$prev"; then
  3193.       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  3194.       $echo "$help" 1>&2
  3195.       exit 1
  3196.     fi
  3197.  
  3198.     if test -z "$files"; then
  3199.       if test -z "$dest"; then
  3200.     $echo "$modename: no file or destination specified" 1>&2
  3201.       else
  3202.     $echo "$modename: you must specify a destination" 1>&2
  3203.       fi
  3204.       $echo "$help" 1>&2
  3205.       exit 1
  3206.     fi
  3207.  
  3208.     # Strip any trailing slash from the destination.
  3209.     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  3210.  
  3211.     # Check to see that the destination is a directory.
  3212.     test -d "$dest" && isdir=yes
  3213.     if test "$isdir" = yes; then
  3214.       destdir="$dest"
  3215.       destname=
  3216.     else
  3217.       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  3218.       test "X$destdir" = "X$dest" && destdir=.
  3219.       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  3220.  
  3221.       # Not a directory, so check to see that there is only one file specified.
  3222.       set dummy $files
  3223.       if test $# -gt 2; then
  3224.     $echo "$modename: \`$dest' is not a directory" 1>&2
  3225.     $echo "$help" 1>&2
  3226.     exit 1
  3227.       fi
  3228.     fi
  3229.     case "$destdir" in
  3230.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  3231.     *)
  3232.       for file in $files; do
  3233.     case "$file" in
  3234.     *.lo) ;;
  3235.     *)
  3236.       $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  3237.       $echo "$help" 1>&2
  3238.       exit 1
  3239.       ;;
  3240.     esac
  3241.       done
  3242.       ;;
  3243.     esac
  3244.  
  3245.     # This variable tells wrapper scripts just to set variables rather
  3246.     # than running their programs.
  3247.     libtool_install_magic="$magic"
  3248.  
  3249.     staticlibs=
  3250.     future_libdirs=
  3251.     current_libdirs=
  3252.     for file in $files; do
  3253.  
  3254.       # Do each installation.
  3255.       case "$file" in
  3256.       *.a | *.lib)
  3257.     # Do the static libraries later.
  3258.     staticlibs="$staticlibs $file"
  3259.     ;;
  3260.  
  3261.       *.la)
  3262.     # Check to see that this really is a libtool archive.
  3263.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3264.     else
  3265.       $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  3266.       $echo "$help" 1>&2
  3267.       exit 1
  3268.     fi
  3269.  
  3270.     library_names=
  3271.     old_library=
  3272.     # If there is no directory component, then add one.
  3273.     case "$file" in
  3274.     */* | *\\*) . $file ;;
  3275.     *) . ./$file ;;
  3276.     esac
  3277.  
  3278.     # Add the libdir to current_libdirs if it is the destination.
  3279.     if test "X$destdir" = "X$libdir"; then
  3280.       case "$current_libdirs " in
  3281.       *" $libdir "*) ;;
  3282.       *) current_libdirs="$current_libdirs $libdir" ;;
  3283.       esac
  3284.     else
  3285.       # Note the libdir as a future libdir.
  3286.       case "$future_libdirs " in
  3287.       *" $libdir "*) ;;
  3288.       *) future_libdirs="$future_libdirs $libdir" ;;
  3289.       esac
  3290.     fi
  3291.  
  3292.     dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  3293.     test "X$dir" = "X$file/" && dir=
  3294.     dir="$dir$objdir"
  3295.  
  3296.     # See the names of the shared library.
  3297.     set dummy $library_names
  3298.     if test -n "$2"; then
  3299.       realname="$2"
  3300.       shift
  3301.       shift
  3302.  
  3303.       # Install the shared library and build the symlinks.
  3304.       $show "$install_prog $dir/$realname $destdir/$realname"
  3305.       $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  3306.  
  3307.       if test $# -gt 0; then
  3308.         # Delete the old symlinks, and create new ones.
  3309.         for linkname
  3310.         do
  3311.           if test "$linkname" != "$realname"; then
  3312.         $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3313.         $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3314.           fi
  3315.         done
  3316.       fi
  3317.  
  3318.       # Do each command in the postinstall commands.
  3319.       lib="$destdir/$realname"
  3320.       eval cmds=\"$postinstall_cmds\"
  3321.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3322.       for cmd in $cmds; do
  3323.         IFS="$save_ifs"
  3324.         $show "$cmd"
  3325.         $run eval "$cmd" || exit $?
  3326.       done
  3327.       IFS="$save_ifs"
  3328.     fi
  3329.  
  3330.     # Install the pseudo-library for information purposes.
  3331.     name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3332.     instname="$dir/$name"i
  3333.     $show "$install_prog $instname $destdir/$name"
  3334.     $run eval "$install_prog $instname $destdir/$name" || exit $?
  3335.  
  3336.     # Maybe install the static library, too.
  3337.     test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  3338.     ;;
  3339.  
  3340.       *.lo)
  3341.     # Install (i.e. copy) a libtool object.
  3342.  
  3343.     # Figure out destination file name, if it wasn't already specified.
  3344.     if test -n "$destname"; then
  3345.       destfile="$destdir/$destname"
  3346.     else
  3347.       destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3348.       destfile="$destdir/$destfile"
  3349.     fi
  3350.  
  3351.     # Deduce the name of the destination old-style object file.
  3352.     case "$destfile" in
  3353.     *.lo)
  3354.       staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  3355.       ;;
  3356.     *.o | *.obj)
  3357.       staticdest="$destfile"
  3358.       destfile=
  3359.       ;;
  3360.     *)
  3361.       $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  3362.       $echo "$help" 1>&2
  3363.       exit 1
  3364.       ;;
  3365.     esac
  3366.  
  3367.     # Install the libtool object if requested.
  3368.     if test -n "$destfile"; then
  3369.       $show "$install_prog $file $destfile"
  3370.       $run eval "$install_prog $file $destfile" || exit $?
  3371.     fi
  3372.  
  3373.     # Install the old object if enabled.
  3374.     if test "$build_old_libs" = yes; then
  3375.       # Deduce the name of the old-style object file.
  3376.       staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  3377.  
  3378.       $show "$install_prog $staticobj $staticdest"
  3379.       $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  3380.     fi
  3381.     exit 0
  3382.     ;;
  3383.  
  3384.       *)
  3385.     # Figure out destination file name, if it wasn't already specified.
  3386.     if test -n "$destname"; then
  3387.       destfile="$destdir/$destname"
  3388.     else
  3389.       destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3390.       destfile="$destdir/$destfile"
  3391.     fi
  3392.  
  3393.     # Do a test to see if this is really a libtool program.
  3394.     if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3395.       link_against_libtool_libs=
  3396.       relink_command=
  3397.  
  3398.       # If there is no directory component, then add one.
  3399.       case "$file" in
  3400.       */* | *\\*) . $file ;;
  3401.       *) . ./$file ;;
  3402.       esac
  3403.  
  3404.       # Check the variables that should have been set.
  3405.       if test -z "$link_against_libtool_libs"; then
  3406.         $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  3407.         exit 1
  3408.       fi
  3409.  
  3410.       finalize=yes
  3411.       for lib in $link_against_libtool_libs; do
  3412.         # Check to see that each library is installed.
  3413.         libdir=
  3414.         if test -f "$lib"; then
  3415.           # If there is no directory component, then add one.
  3416.           case "$lib" in
  3417.           */* | *\\*) . $lib ;;
  3418.           *) . ./$lib ;;
  3419.           esac
  3420.         fi
  3421.         libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  3422.         if test -n "$libdir" && test ! -f "$libfile"; then
  3423.           $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  3424.           finalize=no
  3425.         fi
  3426.       done
  3427.  
  3428.       outputname=
  3429.       if test "$fast_install" = no && test -n "$relink_command"; then
  3430.         if test "$finalize" = yes && test -z "$run"; then
  3431.           tmpdir="/tmp"
  3432.           test -n "$TMPDIR" && tmpdir="$TMPDIR"
  3433.           tmpdir="$tmpdir/libtool-$$"
  3434.           if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  3435.           else
  3436.         $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  3437.         continue
  3438.           fi
  3439.           outputname="$tmpdir/$file"
  3440.           # Replace the output file specification.
  3441.           relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  3442.  
  3443.           $show "$relink_command"
  3444.           if $run eval "$relink_command"; then :
  3445.           else
  3446.         $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  3447.         ${rm}r "$tmpdir"
  3448.         continue
  3449.           fi
  3450.           file="$outputname"
  3451.         else
  3452.           $echo "$modename: warning: cannot relink \`$file'" 1>&2
  3453.         fi
  3454.       else
  3455.         # Install the binary that we compiled earlier.
  3456.         file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  3457.       fi
  3458.     fi
  3459.  
  3460.     $show "$install_prog$stripme $file $destfile"
  3461.     $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  3462.     test -n "$outputname" && ${rm}r "$tmpdir"
  3463.     ;;
  3464.       esac
  3465.     done
  3466.  
  3467.     for file in $staticlibs; do
  3468.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3469.  
  3470.       # Set up the ranlib parameters.
  3471.       oldlib="$destdir/$name"
  3472.  
  3473.       $show "$install_prog $file $oldlib"
  3474.       $run eval "$install_prog \$file \$oldlib" || exit $?
  3475.  
  3476.       # Do each command in the postinstall commands.
  3477.       eval cmds=\"$old_postinstall_cmds\"
  3478.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3479.       for cmd in $cmds; do
  3480.     IFS="$save_ifs"
  3481.     $show "$cmd"
  3482.     $run eval "$cmd" || exit $?
  3483.       done
  3484.       IFS="$save_ifs"
  3485.     done
  3486.  
  3487.     if test -n "$future_libdirs"; then
  3488.       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  3489.     fi
  3490.  
  3491.     if test -n "$current_libdirs"; then
  3492.       # Maybe just do a dry run.
  3493.       test -n "$run" && current_libdirs=" -n$current_libdirs"
  3494.       exec $SHELL $0 --finish$current_libdirs
  3495.       exit 1
  3496.     fi
  3497.  
  3498.     exit 0
  3499.     ;;
  3500.  
  3501.   # libtool finish mode
  3502.   finish)
  3503.     modename="$modename: finish"
  3504.     libdirs="$nonopt"
  3505.     admincmds=
  3506.  
  3507.     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3508.       for dir
  3509.       do
  3510.     libdirs="$libdirs $dir"
  3511.       done
  3512.  
  3513.       for libdir in $libdirs; do
  3514.     if test -n "$finish_cmds"; then
  3515.       # Do each command in the finish commands.
  3516.       eval cmds=\"$finish_cmds\"
  3517.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3518.       for cmd in $cmds; do
  3519.         IFS="$save_ifs"
  3520.         $show "$cmd"
  3521.         $run eval "$cmd" || admincmds="$admincmds
  3522.        $cmd"
  3523.       done
  3524.       IFS="$save_ifs"
  3525.     fi
  3526.     if test -n "$finish_eval"; then
  3527.       # Do the single finish_eval.
  3528.       eval cmds=\"$finish_eval\"
  3529.       $run eval "$cmds" || admincmds="$admincmds
  3530.        $cmds"
  3531.     fi
  3532.       done
  3533.     fi
  3534.  
  3535.     # Exit here if they wanted silent mode.
  3536.     test "$show" = : && exit 0
  3537.  
  3538.     echo "----------------------------------------------------------------------"
  3539.     echo "Libraries have been installed in:"
  3540.     for libdir in $libdirs; do
  3541.       echo "   $libdir"
  3542.     done
  3543.     echo
  3544.     echo "If you ever happen to want to link against installed libraries"
  3545.     echo "in a given directory, LIBDIR, you must either use libtool, and"
  3546.     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  3547.     echo "flag during linking and do at least one of the following:"
  3548.     if test -n "$shlibpath_var"; then
  3549.       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  3550.       echo "     during execution"
  3551.     fi
  3552.     if test -n "$runpath_var"; then
  3553.       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  3554.       echo "     during linking"
  3555.     fi
  3556.     if test -n "$hardcode_libdir_flag_spec"; then
  3557.       libdir=LIBDIR
  3558.       eval flag=\"$hardcode_libdir_flag_spec\"
  3559.  
  3560.       echo "   - use the \`$flag' linker flag"
  3561.     fi
  3562.     if test -n "$admincmds"; then
  3563.       echo "   - have your system administrator run these commands:$admincmds"
  3564.     fi
  3565.     if test -f /etc/ld.so.conf; then
  3566.       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  3567.     fi
  3568.     echo
  3569.     echo "See any operating system documentation about shared libraries for"
  3570.     echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3571.     echo "----------------------------------------------------------------------"
  3572.     exit 0
  3573.     ;;
  3574.  
  3575.   # libtool execute mode
  3576.   execute)
  3577.     modename="$modename: execute"
  3578.  
  3579.     # The first argument is the command name.
  3580.     cmd="$nonopt"
  3581.     if test -z "$cmd"; then
  3582.       $echo "$modename: you must specify a COMMAND" 1>&2
  3583.       $echo "$help"
  3584.       exit 1
  3585.     fi
  3586.  
  3587.     # Handle -dlopen flags immediately.
  3588.     for file in $execute_dlfiles; do
  3589.       if test ! -f "$file"; then
  3590.     $echo "$modename: \`$file' is not a file" 1>&2
  3591.     $echo "$help" 1>&2
  3592.     exit 1
  3593.       fi
  3594.  
  3595.       dir=
  3596.       case "$file" in
  3597.       *.la)
  3598.     # Check to see that this really is a libtool archive.
  3599.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3600.     else
  3601.       $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3602.       $echo "$help" 1>&2
  3603.       exit 1
  3604.     fi
  3605.  
  3606.     # Read the libtool library.
  3607.     dlname=
  3608.     library_names=
  3609.  
  3610.     # If there is no directory component, then add one.
  3611.     case "$file" in
  3612.     */* | *\\*) . $file ;;
  3613.     *) . ./$file ;;
  3614.     esac
  3615.  
  3616.     # Skip this library if it cannot be dlopened.
  3617.     if test -z "$dlname"; then
  3618.       # Warn if it was a shared library.
  3619.       test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  3620.       continue
  3621.     fi
  3622.  
  3623.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3624.     test "X$dir" = "X$file" && dir=.
  3625.  
  3626.     if test -f "$dir/$objdir/$dlname"; then
  3627.       dir="$dir/$objdir"
  3628.     else
  3629.       $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  3630.       exit 1
  3631.     fi
  3632.     ;;
  3633.  
  3634.       *.lo)
  3635.     # Just add the directory containing the .lo file.
  3636.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3637.     test "X$dir" = "X$file" && dir=.
  3638.     ;;
  3639.  
  3640.       *)
  3641.     $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  3642.     continue
  3643.     ;;
  3644.       esac
  3645.  
  3646.       # Get the absolute pathname.
  3647.       absdir=`cd "$dir" && pwd`
  3648.       test -n "$absdir" && dir="$absdir"
  3649.  
  3650.       # Now add the directory to shlibpath_var.
  3651.       if eval "test -z \"\$$shlibpath_var\""; then
  3652.     eval "$shlibpath_var=\"\$dir\""
  3653.       else
  3654.     eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3655.       fi
  3656.     done
  3657.  
  3658.     # This variable tells wrapper scripts just to set shlibpath_var
  3659.     # rather than running their programs.
  3660.     libtool_execute_magic="$magic"
  3661.  
  3662.     # Check if any of the arguments is a wrapper script.
  3663.     args=
  3664.     for file
  3665.     do
  3666.       case "$file" in
  3667.       -*) ;;
  3668.       *)
  3669.     # Do a test to see if this is really a libtool program.
  3670.     if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3671.       # If there is no directory component, then add one.
  3672.       case "$file" in
  3673.       */* | *\\*) . $file ;;
  3674.       *) . ./$file ;;
  3675.       esac
  3676.  
  3677.       # Transform arg to wrapped name.
  3678.       file="$progdir/$program"
  3679.     fi
  3680.     ;;
  3681.       esac
  3682.       # Quote arguments (to preserve shell metacharacters).
  3683.       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  3684.       args="$args \"$file\""
  3685.     done
  3686.  
  3687.     if test -z "$run"; then
  3688.       if test -n "$shlibpath_var"; then
  3689.         # Export the shlibpath_var.
  3690.         eval "export $shlibpath_var"
  3691.       fi
  3692.  
  3693.       # Restore saved enviroment variables
  3694.       if test "${save_LC_ALL+set}" = set; then
  3695.     LC_ALL="$save_LC_ALL"; export LC_ALL
  3696.       fi
  3697.       if test "${save_LANG+set}" = set; then
  3698.     LANG="$save_LANG"; export LANG
  3699.       fi
  3700.  
  3701.       # Now actually exec the command.
  3702.       eval "exec \$cmd$args"
  3703.  
  3704.       $echo "$modename: cannot exec \$cmd$args"
  3705.       exit 1
  3706.     else
  3707.       # Display what would be done.
  3708.       if test -n "$shlibpath_var"; then
  3709.         eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  3710.         $echo "export $shlibpath_var"
  3711.       fi
  3712.       $echo "$cmd$args"
  3713.       exit 0
  3714.     fi
  3715.     ;;
  3716.  
  3717.   # libtool uninstall mode
  3718.   uninstall)
  3719.     modename="$modename: uninstall"
  3720.     rm="$nonopt"
  3721.     files=
  3722.  
  3723.     for arg
  3724.     do
  3725.       case "$arg" in
  3726.       -*) rm="$rm $arg" ;;
  3727.       *) files="$files $arg" ;;
  3728.       esac
  3729.     done
  3730.  
  3731.     if test -z "$rm"; then
  3732.       $echo "$modename: you must specify an RM program" 1>&2
  3733.       $echo "$help" 1>&2
  3734.       exit 1
  3735.     fi
  3736.  
  3737.     for file in $files; do
  3738.       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3739.       test "X$dir" = "X$file" && dir=.
  3740.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3741.  
  3742.       rmfiles="$file"
  3743.  
  3744.       case "$name" in
  3745.       *.la)
  3746.     # Possibly a libtool archive, so verify it.
  3747.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3748.       . $dir/$name
  3749.  
  3750.       # Delete the libtool libraries and symlinks.
  3751.       for n in $library_names; do
  3752.         rmfiles="$rmfiles $dir/$n"
  3753.       done
  3754.       test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  3755.  
  3756.       $show "$rm $rmfiles"
  3757.       $run $rm $rmfiles
  3758.  
  3759.       if test -n "$library_names"; then
  3760.         # Do each command in the postuninstall commands.
  3761.         eval cmds=\"$postuninstall_cmds\"
  3762.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3763.         for cmd in $cmds; do
  3764.           IFS="$save_ifs"
  3765.           $show "$cmd"
  3766.           $run eval "$cmd"
  3767.         done
  3768.         IFS="$save_ifs"
  3769.       fi
  3770.  
  3771.       if test -n "$old_library"; then
  3772.         # Do each command in the old_postuninstall commands.
  3773.         eval cmds=\"$old_postuninstall_cmds\"
  3774.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3775.         for cmd in $cmds; do
  3776.           IFS="$save_ifs"
  3777.           $show "$cmd"
  3778.           $run eval "$cmd"
  3779.         done
  3780.         IFS="$save_ifs"
  3781.       fi
  3782.  
  3783.       # FIXME: should reinstall the best remaining shared library.
  3784.     fi
  3785.     ;;
  3786.  
  3787.       *.lo)
  3788.     if test "$build_old_libs" = yes; then
  3789.       oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  3790.       rmfiles="$rmfiles $dir/$oldobj"
  3791.     fi
  3792.     $show "$rm $rmfiles"
  3793.     $run $rm $rmfiles
  3794.     ;;
  3795.  
  3796.       *)
  3797.     $show "$rm $rmfiles"
  3798.     $run $rm $rmfiles
  3799.     ;;
  3800.       esac
  3801.     done
  3802.     exit 0
  3803.     ;;
  3804.  
  3805.   "")
  3806.     $echo "$modename: you must specify a MODE" 1>&2
  3807.     $echo "$generic_help" 1>&2
  3808.     exit 1
  3809.     ;;
  3810.   esac
  3811.  
  3812.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3813.   $echo "$generic_help" 1>&2
  3814.   exit 1
  3815. fi # test -z "$show_help"
  3816.  
  3817. # We need to display help for each of the modes.
  3818. case "$mode" in
  3819. "") $echo \
  3820. "Usage: $modename [OPTION]... [MODE-ARG]...
  3821.  
  3822. Provide generalized library-building support services.
  3823.  
  3824.     --config          show all configuration variables
  3825.     --debug           enable verbose shell tracing
  3826. -n, --dry-run         display commands without modifying any files
  3827.     --features        display basic configuration information and exit
  3828.     --finish          same as \`--mode=finish'
  3829.     --help            display this help message and exit
  3830.     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  3831.     --quiet           same as \`--silent'
  3832.     --silent          don't print informational messages
  3833.     --version         print version information
  3834.  
  3835. MODE must be one of the following:
  3836.  
  3837.       compile         compile a source file into a libtool object
  3838.       execute         automatically set library path, then run a program
  3839.       finish          complete the installation of libtool libraries
  3840.       install         install libraries or executables
  3841.       link            create a library or an executable
  3842.       uninstall       remove libraries from an installed directory
  3843.  
  3844. MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  3845. a more detailed description of MODE."
  3846.   exit 0
  3847.   ;;
  3848.  
  3849. compile)
  3850.   $echo \
  3851. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3852.  
  3853. Compile a source file into a libtool library object.
  3854.  
  3855. This mode accepts the following additional options:
  3856.  
  3857.   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  3858.   -static           always build a \`.o' file suitable for static linking
  3859.  
  3860. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  3861. from the given SOURCEFILE.
  3862.  
  3863. The output file name is determined by removing the directory component from
  3864. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  3865. library object suffix, \`.lo'."
  3866.   ;;
  3867.  
  3868. execute)
  3869.   $echo \
  3870. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  3871.  
  3872. Automatically set library path, then run a program.
  3873.  
  3874. This mode accepts the following additional options:
  3875.  
  3876.   -dlopen FILE      add the directory containing FILE to the library path
  3877.  
  3878. This mode sets the library path environment variable according to \`-dlopen'
  3879. flags.
  3880.  
  3881. If any of the ARGS are libtool executable wrappers, then they are translated
  3882. into their corresponding uninstalled binary, and any of their required library
  3883. directories are added to the library path.
  3884.  
  3885. Then, COMMAND is executed, with ARGS as arguments."
  3886.   ;;
  3887.  
  3888. finish)
  3889.   $echo \
  3890. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  3891.  
  3892. Complete the installation of libtool libraries.
  3893.  
  3894. Each LIBDIR is a directory that contains libtool libraries.
  3895.  
  3896. The commands that this mode executes may require superuser privileges.  Use
  3897. the \`--dry-run' option if you just want to see what would be executed."
  3898.   ;;
  3899.  
  3900. install)
  3901.   $echo \
  3902. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  3903.  
  3904. Install executables or libraries.
  3905.  
  3906. INSTALL-COMMAND is the installation command.  The first component should be
  3907. either the \`install' or \`cp' program.
  3908.  
  3909. The rest of the components are interpreted as arguments to that command (only
  3910. BSD-compatible install options are recognized)."
  3911.   ;;
  3912.  
  3913. link)
  3914.   $echo \
  3915. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  3916.  
  3917. Link object files or libraries together to form another library, or to
  3918. create an executable program.
  3919.  
  3920. LINK-COMMAND is a command using the C compiler that you would use to create
  3921. a program from several object files.
  3922.  
  3923. The following components of LINK-COMMAND are treated specially:
  3924.  
  3925.   -all-static       do not do any dynamic linking at all
  3926.   -avoid-version    do not add a version suffix if possible
  3927.   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  3928.   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  3929.   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3930.   -export-symbols SYMFILE
  3931.             try to export only the symbols listed in SYMFILE
  3932.   -export-symbols-regex REGEX
  3933.             try to export only the symbols matching REGEX
  3934.   -LLIBDIR          search LIBDIR for required installed libraries
  3935.   -lNAME            OUTPUT-FILE requires the installed library libNAME
  3936.   -module           build a library that can dlopened
  3937.   -no-undefined     declare that a library does not refer to external symbols
  3938.   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  3939.   -release RELEASE  specify package release information
  3940.   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  3941.   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  3942.   -static           do not do any dynamic linking of libtool libraries
  3943.   -version-info CURRENT[:REVISION[:AGE]]
  3944.             specify library version info [each variable defaults to 0]
  3945.  
  3946. All other options (arguments beginning with \`-') are ignored.
  3947.  
  3948. Every other argument is treated as a filename.  Files ending in \`.la' are
  3949. treated as uninstalled libtool libraries, other files are standard or library
  3950. object files.
  3951.  
  3952. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  3953. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  3954. required, except when creating a convenience library.
  3955.  
  3956. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  3957. using \`ar' and \`ranlib', or on Windows using \`lib'.
  3958.  
  3959. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  3960. is created, otherwise an executable program is created."
  3961.   ;;
  3962.  
  3963. uninstall)
  3964.   $echo \
  3965. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3966.  
  3967. Remove libraries from an installation directory.
  3968.  
  3969. RM is the name of the program to use to delete files associated with each FILE
  3970. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  3971. to RM.
  3972.  
  3973. If FILE is a libtool library, all the files associated with it are deleted.
  3974. Otherwise, only FILE itself is deleted using RM."
  3975.   ;;
  3976.  
  3977. *)
  3978.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3979.   $echo "$help" 1>&2
  3980.   exit 1
  3981.   ;;
  3982. esac
  3983.  
  3984. echo
  3985. $echo "Try \`$modename --help' for more information about other modes."
  3986.  
  3987. exit 0
  3988.  
  3989. # Local Variables:
  3990. # mode:shell-script
  3991. # sh-indentation:2
  3992. # End:
  3993.